سؤال

I've been trying to see why a certain jQuery .sortable() will not enable any drag/drop events in some circumstances - In a certain jQuery dialog I have a sortable, I confirm that the element exists while debugging ($('theelement') is length 1, just before calling $('theelement').sortable()).

I verify the events are there, with Chrome's inspector, and I can't see any reason it wouldn't be doing the exact same code that is working in another jQuery dialog, in which allows drag-drop reordering. I've removed classes of the container to make it similar to the one in which it works, in case something like jQuery('.something theelement').mouseup(function(){return false}) is firing.

I've also simplified the code by changing the sortable to something as simple as

<ul target element>
  <li>test</li>
  <li>test</li>
</ul>

and calling jquery(target element).sortable() so it shouldn't be some complex css or dom issue causing this.

Is there anything other than debugging each step through each line of the minified jQuery-ui source, to find the source of this problem?

هل كانت مفيدة؟

المحلول

Oddly enough, draggable() does work. So does removing the function with jQuery(element).data('uiSortable','') before adding sortable again. adding ':visible' to the jquery input also prevents the whole problem of corrupting the element somehow when that was called before it was shown, which was preventing it from ever working.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top