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

后端 未结 6 784
感动是毒
感动是毒 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:51

    I use this and I think it's the best solution.

    $("ul").selectable({
        filter: "li"
    });
    
    $("ul").on("mousedown","li",function(e){
        var n = ($(e.toElement).is(".ui-selected")) ? 1 : 0;
        $("#filelist").selectable( "option", "distance", n );
    });
    

    When the user starts a click on a selected elements I set the distance to one so that the doesn't blocks the double click event, but I available if the user really starts selecting.

提交回复
热议问题