How to enable dblclick event on elements which was binded with JQuery UI Selectable plugin?

后端 未结 6 799
感动是毒
感动是毒 2020-12-19 06:21

In my case,I have an UL with JQuery UI Selectable plugin applied,but at the same time ,I want the item witch was binded with selectable plugin was

6条回答
  •  伪装坚强ぢ
    2020-12-19 06:35

    If you add .ui-selected to cancel options passed into selectable method then you can double click b/c it will not raise selecting event on .ui-selected items.

    $('#selectable').selectable({ 
      cancel: '.ui-selected' 
    });
    

    Although, this does take away the ability to deselect a selected item. You could do the following to manually deselect

    $('.ui-selected').on('click', function() {
      $(this)
        .removeClass('ui-selected')
        .parents('.ui-selectable')
        .trigger('selectablestop');
    
      // you might also want to trigger selectablestop.
    });
    

提交回复
热议问题