gpt4 book ai didi

jQuery:淡出然后滑动

转载 作者:行者123 更新时间:2023-12-03 21:32:08 25 4
gpt4 key购买 nike

如果一个项目被删除,那么我想将其淡出并向上滑动其他元素以填充空白空间。现在,当我使用 fadeOut() 时,该项目末尾没有高度,这会导致其他项目向上跳跃(而不是很好地向上滑动)。

如何在 fadeOut() 之后使用 slideUp() 和元素?

最佳答案

听起来使用 jQuery 会更好 fadeTo命令

 $(function() {

$("#myButton").click(function() {
$("#myDiv").fadeTo("slow", 0.00, function(){ //fade
$(this).slideUp("slow", function() { //slide up
$(this).remove(); //then remove from the DOM
});
});

});

});

Working Demo here

通过在前一个命令的回调函数中执行每个命令,该命令将在前一个命令完成之前不会运行;当元素从 DOM 中移除而没有等待 SlideUp 完成时,就会发生“跳转”。

关于jQuery:淡出然后滑动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/734554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com