【发布时间】:2013-04-16 09:52:29
【问题描述】:
我有一个 .hide() 函数,它根据复选框隐藏 div。
JS Fiddle of it working here Real site example here
我正在尝试给它动画,以便.hide() 将淡入/淡出而不是消失。
尝试使用 jQuery Fade 函数,但作为 .hide() 的参数但似乎不起作用
$("div").click(function () {
$(this).hide("fade", {}, 1000);
});
我尝试在我的代码中使用它(参见 JS Fiddle),如下所示:
if(allSelected.length > 0){
$("div.prodGrid > div:not(" + allSelected + ")").hide("fade", {}, 1000);
}
我哪里错了?
【问题讨论】:
-
这里要注意的重要一点是
hide()方法根本不带效果参数。阅读the method's documentation 以查看不同的论点。在此类方法中,第一个参数或参数属性通常是duration参数。