What should I do when events conflicted between JQuery plugins?
I have tow plugins attach to the parent element
and its children
.
parent attached with JQuery UI selectable plugin
and its children attached with a plugin called jquery contextmenu.
With the jquery contextMenu plguin
,there is a mousedown event
with $.stopPropagation()
function applied.
partial of the contextMenu code:
(this).mousedown( function(e) {
var evt = e;
evt.stopPropagation();
$(this).mouseup( function(e) {
e.stopPropagation();
// more code below...
});
But at the same time,the JQuery UI selectable
seems to use the mousedown event
to make elements selection,so,because the contextMenu
,the selectable plugin
couldn't make selection any more.
Now,I had to remove the code $.stopPropagation() of contextMenu
a开发者_运维知识库nd the selectable plugin
work again and I hope this way didn't break the contextMenu plugin
.
And finally , what should I do to make them work together without modify the code,because it is danger to do this??
Thank you very much!!
Have you tried simply "return false" from the event handler? This would contain the propagation.
精彩评论