为什么jQuery UI show()用“blind”删除元素?

时间:2011-11-25 17:25:22

标签: jquery-ui animation

我试图使用“盲”动画显示元素:

<div onclick="$('#animatable').show('blind', null, 1000);">Click me</div>
<div style="display: none;" id="animatable">Animated</div>

但它只运作一次。元素出现盲目效果,然后它完全消失,即使在Firebug DOM中我也看不到它!为什么不能保持可见?

其他一些show()动画(“爆炸”),工作正常,但也“幻灯片”使元素消失。

更新:

它在jsFiddle中工作正常,但在Firefox中不起作用。

我正在使用jQuery UI 1.8.16完全缩小文件和jQuery v1.7。 我想,我会从头开始尝试一个裸露的页面,但是如果有人已经经历过这样的行为并且知道为什么会这样,那么仍然在等待建议。

2 个答案:

答案 0 :(得分:1)

这应该有效,这是工作示例:

http://jsfiddle.net/rogal111/Rk2rA/

检查jquery&amp;的版本UI。

答案 1 :(得分:0)

我刚发现问题。

许多Javascript插件之一正在使用来自的代码 http://www.bennadel.com/blog/1624-Ask-Ben-Overriding-Core-jQuery-Methods.htm

var originalRemoveMethod = jQuery.fn.remove;

// Define overriding method.
jQuery.fn.remove = function(){
// Log the fact that we are calling our override.
console.log( "Override method" );

// Execute the original method.
originalRemoveMethod.apply( this, arguments );
}

问题是它没有返回任何值,并且以某种方式打破了jquery UI。 我添加了

return originalRemoveMethod.apply( this, arguments );

现在似乎工作正常。我只是希望,这不会破坏其他东西......

所有人的教训是:不要弄乱remove()函数。