为什么jQuery UI不隐藏隐藏父元素的元素? [英] Why doesn't jQuery UI hide element with hidden parent?

查看:68
本文介绍了为什么jQuery UI不隐藏隐藏父元素的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一个单页应用程序,并注意到我的下拉有时会在他们想要被隐藏时保持打开状态。我调查了为什么会发生这种情况,并发现如果隐藏了父元素,使用扩展隐藏函数隐藏jQuery UI元素是没有价值的。

I've been working on an one page app, and noticed that my dropdowns stays open sometimes when they suppose to be hidden. I investigated why that happens and find out that if parent element is hidden, hiding element with jQuery UI using extended hide functions is worthless.

这个小提琴示例显示了我的意思,只是尝试点击隐藏& 显示按钮,然后单击显示parent1 并尝试隐藏元素。您会注意到状态指示器会立即更新,但一旦您返回 parent2 ,您将看到该元素仍然可见。

This fiddle example which shows what I mean, just try to click Hide & Show buttons, and then click Show parent1 and try to hide element there. You'll notice that status indicator gets updated instantly but once you back to parent2 you'll see the element is still visible.

我发现使用jQuery 隐藏没有参数或只传递了毫秒数,它确实正常工作并且一旦我用jQuery UI参数更新它就停止工作,所以我假设它是jQuery UI而不是jQuery本身的问题。

I found that using jQuery hide without arguments or only with miliseconds passed, it does work correctly and stops working once I update it with jQuery UI arguments, so I assume it is jQuery UI not jQuery itself problem.

所以我的问题是为什么jQuery UI以这种方式工作,是它假设工作的方式还是一个bug ?

So my question is why jQuery UI is working in this way, is that the way it suppose to work or it is a bug?

推荐答案

这是jQuery UI中的一个错误,已在1.10.2中修复。

It was a bug in jQuery UI, which got fixed in 1.10.2.

以下是错误报告单的链接
http://错误。 jqueryui.com/ticket/9120

Here is a link to bug report ticket http://bugs.jqueryui.com/ticket/9120

这篇关于为什么jQuery UI不隐藏隐藏父元素的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆