简体   繁体   English

嵌套的Sortable插件始终使浏览器崩溃

[英]Nested Sortable plugin consistently crashes browsers

Here's the fiddle: http://jsfiddle.net/scZtb/1/ 这是小提琴: http : //jsfiddle.net/scZtb/1/

Be warned, as the title suggests, this might crash your browser (or at least the tab, if you're in Chrome). 如标题所示,请注意,这可能会使您的浏览器崩溃(或者如果您使用的是Chrome,则至少是该标签页)。

I'm trying to get this example to work. 我正在尝试使此示例起作用。 I've copied it almost exactly, so I don't know why it would work there, but not in my example. 我已经几乎完全复制了它,所以我不知道为什么它可以在那里工作,但在我的示例中却不行。

Anyone know what I'm doing wrong? 有人知道我在做什么错吗?

Not sure why you are wanting/needing .nestedSortable, which I don't see documented on the jQueryUI site. 不知道为什么要/需要.nestedSortable,我在jQueryUI网站上没有看到它。 When I change it to use .sortable, it appears to work correctly. 当我将其更改为使用.sortable时,它似乎可以正常工作。 (Using latest Firefox) (使用最新的Firefox)

Okay, you are using the selector 'ul' in this case, your example doesn't have a nested UL element, but when you do, you are effectively calling the plugin on the original outer list, and again on the inner list... 好的,在这种情况下,您使用的是选择器'ul',您的示例没有嵌套的UL元素,但是当您这样做时,您实际上是在原始外部列表上以及内部列表上再次调用了插件。 。

See recursion... When you use a generic selector with jQuery/jQueryUI you select ALL matching elements, and are calling the plugin on the outer item, then the inner item... 请参阅递归...当将通用选择器与jQuery / jQueryUI结合使用时,您将选择所有匹配元素,并在外部项上调用插件,然后在内部项上调用插件...

It seems to only work with <ol> s not <ul> s. 它似乎仅适用于<ol>而不适用于<ul> I can't imagine why that is, but I can work with that. 我无法想象为什么会这样,但是我可以解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM