问题
I have a list of items I want to make sortable. I would like to make that list scrollable, but at the same time I want the handle to pop out to the side of the list.
When clicking on an list item, I can have the pop out show outside the list (at this point, I know which li they have selected), and when they mousedown on a button in the popout, I create the sortable.
Can I create the sortable with the current li as the item being dragged?
The core issue here that I'm trying to work around is that I can make the pop out the handle IF it is a descendant of the item. But if I make the list scrollable, it will clip the handle so I can't pop it out to the right.
IF the pop out is not a descendant of the li, I can position it exactly where I want (to the right of the selected li) but now it cannot be used as the handle for the sortable (since it is not a descendant).
I am wondering if I can programatically create the sortable with the selected li as the item being dragged???
来源:https://stackoverflow.com/questions/25213899/jquery-ui-sortable-programmatically-set-item-being-dragged