开发者

How to disable some element reaction to any mouse event without interrupting underlaying element events in jQuery?

I'm trying to make a simple pop-up <div> that's designed to show mouse coordinates while a user is dragging a mouse pointer. This pop-up appears at the bottom on the right to the mouse pointer. The underlaying div has its own very important mouse event handlers (e.g. .mousemove()). The pop-up div is quite far away from the mouse pointer (about 16 pixels downwards and 16 pixels to the right). Let's say, a user is resizing some object, and that pop-up is displaying a new size of that object. This is o.k. if the user is resizing the object slowly. But as soon as the user abruptly resizes the object and points the pop-up div, the underlaying div loses focus, and its event handler, that's responsible for resizing, gets "broken" (it's like the mouse pointer "forgets" the underlying div) because it's not designed to cooperate with overlaying div-s at all.

Is there any ability to suppress any pop-up div mouse events allowing the underlaying div events go strictly continuously?

开发者_如何学Go

I tried something like that:

var BLACK_HOLE = function(e) {
    e.preventDefault();
    e.stopPropagation();
    return false;       
};
$popUp
    .click(BLACK_HOLE)
    .dblclick(BLACK_HOLE)
    .focusin(BLACK_HOLE)
    .focusout(BLACK_HOLE)
    .hover(BLACK_HOLE)
    .mousedown(BLACK_HOLE)
    .mouseenter(BLACK_HOLE)
    .mouseleave(BLACK_HOLE)
    .mousemove(BLACK_HOLE)
    .mouseout(BLACK_HOLE)
    .mouseover(BLACK_HOLE)
    .mouseup(BLACK_HOLE);

It doesn't work the way I need. Did anyone get the same issue? Is it possible to bypass it? Perhaps, there's a complete jQuery plugin for that... Confused...

Thank you in advance.


Proper event bubbling/capturing is the solution and the salvation. The bug is fixed in my application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜