camohub / jquery-sortable-lists

jQuery plugin to sorting lists also the tree structures.
MIT License
209 stars 60 forks source link

Improve ignoreClass #58

Open lark-zet opened 4 years ago

lark-zet commented 4 years ago

How about adding a check for "ignoreClass"? Now, if you use, for example, the plugin "chosen" in the elements of list, then all its elements also become movable. Locally in jquery-sortable-lists.js (on mousedown event) I fixed it like this: target.hasClass( setting.ignoreClass ) -> ( target.hasClass( setting.ignoreClass ) || target.closest('.' + setting.ignoreClass).length )

camohub commented 4 years ago

It is little complicated. Cause target can have a lot of childs and it is too expensive to check all hierarchy for class name.

PS: target.hasClass is not necessary. closest() checks also the target element.