文章目录

Draggable时阻止单击事件

1
2
3
4
5
6
7
$('.selector').draggable({
stop: function(event, ui) {
// event.toElement is the element that was responsible
// for triggering this event. The handle, in case of a draggable.
$( event.toElement ).one('click', function(e){ e.stopImmediatePropagation(); } );
}
});

This works because “one-listeners” are fired before “normal” listeners. So if a one-listener stops propagation, it will never reach your previously set listeners.

文章目录