JQuery sortable lists and fixed/locked items

前端 未结 9 1589
故里飘歌
故里飘歌 2020-11-28 06:07

Is it possible to lock list items in JQuery sortable list in a way that those items will stay in that particular place in the list.

For example,

consider th

9条回答
  •  忘掉有多难
    2020-11-28 06:40

    Check this out: Forcing an item to remain in place in a jQuery UI Sortable list

    Also, I've implemented the above solution with multiple fixed elements here: http://jsfiddle.net/enBnH/12/ (obsolete, see below) It's rather self-explanatory, i think.

    EDIT:

    I've automated the process for generating the lockto values as well as adding ID's to those lis with the class "fixed" (note that i have to add an ID so we can reference it)

    See the COMPLETE solution HERE: http://jsfiddle.net/enBnH/44/

    EDIT

    Okay, after a gazillion errors with the above, i just rewrote the dang thing myself: http://jsfiddle.net/thomas4g/GPMZZ/15/

    NOTE: The above does work, but @DarthJDG's answer seems a lot nicer to me. I'm leaving mine up on the offchance someone might prefer how mine behaves (i've learned not to delete stuff just beceause there's a better version :P )

提交回复
热议问题