我试图隐藏一个完美工作的 div,但我想使用 jQuery slide
用一点动画来隐藏它,而不是立即消失。
$(".hide-reply").click(function(){
$(this).closest('.media').find('.reply-body').hide();
});
我尝试将行更改为(根据 jQuery 文档)-
$(this).closest('.media').find('.reply-body').hide("slide", { direction: "up" }, 100);
但这会抛出一个Uncaught TypeError: n.easing[this.easing] is not a function
我不确定我是否理解这个错误。
最佳答案
尝试使用 .animate()
,将 height
设置为 0
$("div").animate({
height:0
}, 1000);
div {
width:100px;
height:100px;
background:blue;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<div></div>
关于javascript - jQuery 用幻灯片隐藏元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35496166/