gpt4 book ai didi

javascript - 在 angularjs 中使用 ng-show/hide 平滑过渡

转载 作者:行者123 更新时间:2023-11-28 08:58:43 24 4
gpt4 key购买 nike

我是列表中的一些元素,我可以通过单击按钮隐藏/显示这些元素:

ul
li(ng-show="some_condition1") item1
li(ng-show="some_condition2") item2
li(ng-show="some_condition3") item3
li(ng-show="some_condition4") item4

some_condition1 变为假时,item1 消失,所有剩余的元素突然向上移动。有没有办法让它们向上滑动?

我曾考虑过使用 css transitions 这样的东西:transition: all ease 0.2s 但是因为我的元素属性没有被触及,所以它不起作用......

最佳答案

尝试使用以下代码:

var $item = $(this).closest('li');
$item.hide('slow', function(){ $item.remove(); });

关于javascript - 在 angularjs 中使用 ng-show/hide 平滑过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27016271/

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