最佳答案
为什么不使用slideUp()/ slideDown():
尝试在演示中,即使使用.stop()方法也无法实现如下结果:
以下是使用.animate()和高度切换的略微修改:
(只需要:position:absolute; bottom:0px; display:none;)
$('.Box').hover(function(){
$(this).find('.curtain').stop().animate({height: 'toggle'});
});
另一种方式是:
var BoxHeight = $('.Box').innerHeight(); // get element height
$('.curtain').css({top:BoxHeight}); // push 'curtain' down
$('.Box').hover(function(){
$(this).find('.curtain').stop().animate({top: 0}); // animate to desired top distance
},function(){
$(this).find('.curtain').stop().animate({top: BoxHeight}); // and on mouSEOut - back down
});
原文地址:https://www.jb51.cc/jquery/428080.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。