campinam
asked on
JavaScript Events - Remove propagation of iframe wheel events to parent
When scrolling down the document in an iframe, and reach bottom, if keep spinning down the mouse wheel, the parent document starts scrolling. Browsers call it a "dispatch" of wheel event to parent. So it's not bubbling, as it's not within the same document. A new wheel event is created on parent.
Can this "dispatch" be prevented? How? (I use plain JavaScript.)
Is there any sample script available?
Can this "dispatch" be prevented? How? (I use plain JavaScript.)
Is there any sample script available?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
because you are firing lots of javascripts and it takes some time to handle all those events :)
this is just hack to offset scroll by scrolling up :)
this is the best thing you can get I guess...
and actually you should not do such thing, since this is default browser behavior that users get used to it...
this is just hack to offset scroll by scrolling up :)
this is the best thing you can get I guess...
and actually you should not do such thing, since this is default browser behavior that users get used to it...
ASKER
Users get used to it, but when the iframe is a modal on grayed-out parent, and when it was popped by some link on the parent, you don't want to lose the place you were on parent.
But I tried cancelling the wheel event on parent, while the iframe is up, and it won't do, unless you scroll outside the iframe. Maybe they fire some internal browser event with the "dispatch", not accessible in JavaScript? Would you know about that?
But I tried cancelling the wheel event on parent, while the iframe is up, and it won't do, unless you scroll outside the iframe. Maybe they fire some internal browser event with the "dispatch", not accessible in JavaScript? Would you know about that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Julian, thanks a lot! What an idea!!
Of course the background page (the parent) should stay frozen. Nothing could be better.
Really appreciate your help.
Of course the background page (the parent) should stay frozen. Nothing could be better.
Really appreciate your help.
You are welcome.
ASKER
Maybe the triggered events on parent window accumulate and it takes time to sort that out. What do you think?