【发布时间】:2015-09-29 14:24:31
【问题描述】:
我的滑动切换有问题。单击后的黑框将第二个 div 向后滑动,这很好,但它本身不会滑回原来的位置。我怎样才能解决这个问题?
我目前正在使用 Jquery UI。
代码如下:
#recommended-product-block{
position: absolute;
top:225px;
right:0;
z-index: 999999;
width:100px;
}
#weather{
width:150px;
position:absolute;
right: 0;
}
<div id="recommended-product-block">
<h1>Div box to initiate slide toggle</h1>
</div>
<div id="weather">
<h1>Box that slides in and out</h1>
</div>
$(document).ready(function() {
$('#weather').hide();
$(function () {
$("#recommended-product-block").click(function () {
$(this).animate({ right: '+150' }, 400 );
$( "#weather" ).toggle( "slide" );
});
});
});
【问题讨论】: