Ответ 1
Я понял это. Чтобы он скользил влево, я дал соответствующую окружность <div>
ширину и margin-left: 0px;
. Затем у меня возникла проблема обертывания текста, когда ширина была сужена/расширена. Чтобы исправить это, я добавил white-space: nowrap;
в CSS для соответствующего <div>
s.
Здесь jQuery:
$(document).ready(function() {
$('#go-chat input').click(function() {
$('#search, #go-chat').animate(
{
width: '0px'
}, 1000, function() {
$(this).hide();
$('#login, #go-search').animate(
{
width: '573px'
}, 1000, function() {
$(this).show();
}
);
}
);
});
$('#go-search input').click(function() {
$('#login, #go-search').animate(
{
width: '0px'
}, 1000, function() {
$(this).hide();
$('#search, #go-chat').animate(
{
width: '573px'
}, 1000, function() {
$(this).show();
}
);
}
);
});
});
... и CSS:
#search {
border: 1px solid #999999;
-moz-border-radius: 5px;
width: 573px;
height: 40px;
margin: auto;
margin-top: 100px;
margin-left: 0px;
position: relative;
}
#go-chat {
width: 575px;
margin: auto;
margin-top: 36px;
margin-left: 0px;
padding-top: 5px;
white-space: nowrap;
}
#login {
border: 0px;
width: 0px;
display: none;
margin: auto;
margin-top: 100px;
margin-left: 0px;
position: relative;
}
#go-search {
width: 0px;
margin: auto;
margin-top: 36px;
margin-left: 0px;
padding-top: 5px;
white-space: nowrap;
display: none;
}
Если у кого-то есть предложения по тому, как я отформатировал jQuery, пожалуйста, дайте мне знать, что вы думаете... вам нравится, как я отформатировал? Мне кажется, что это выглядит немного неудобно.