Jquery ui - sortable: drag by icon 'handle' within sortable element

后端 未结 1 1449
夕颜
夕颜 2021-01-31 13:02

I have jquery ui sortables working fine but my sortable elements have other interactive elements within them. In order to prevent accidental sorting when interacting with the el

1条回答
  •  -上瘾入骨i
    2021-01-31 13:57

    The option handle of the plugin allows you to define that is the element that can initiate the sort. You can provide a selector or an element.

    If you have this html, with the .handler to be the handle to start the sort:

    • My element

    Apply the option like this:

    $( ".sortable" ).sortable({ handle: '.handle' });
    

    You can style your handle element however you like.

    0 讨论(0)
提交回复
热议问题