Mik*_*ike 11 jquery slider jquery-animate
我这里有一个siple代码:
$('.aktualita_sipky').toggle(function() {
$(this).parent().find('.aktualita_content').animate({
height: "100%",
}, 1500 );
}, function() {
$(this).parent().find('.aktualita_content').animate({
height: "120px",
}, 1500 );
});
Run Code Online (Sandbox Code Playgroud)
现在当我点击它作为第一个'切换'时,它只是立即显示(没有动画),当我点击第二个'切换'时,它很好地向上滑动.
有没有办法用这个漂亮的动画将它滑到100%?
kar*_*m79 10
也许你可以这样做:
$height = $(window).height(); // returns height of browser viewport
//Or
$height = $(document).height(); // returns height of HTML document
//Or
$height = $(whatever).height();
$('.aktualita_sipky').toggle(function() {
$(this).parent().find('.aktualita_content').animate({
height: $height + 'px',
}, 1500 );
}, function() {
$(this).parent().find('.aktualita_content').animate({
height: $height + 'px',
}, 1500 );
});
Run Code Online (Sandbox Code Playgroud)
http://docs.jquery.com/CSS/height
| 归档时间: |
|
| 查看次数: |
35388 次 |
| 最近记录: |