Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem may be that jQuery's event handler wrapper must use <code>window.event</code> to retrieve the current event in IE. If you set a handler from window A on an event in window B, the script in window A will be looking at window A's <code>window.event</code>, whilst the event is actually occurring on window B.</p> <p>But there may be more issues than that, too. Cross-window/frame scripting is fraught with difficulties and jQuery is not particularly designed to work around them. To make jQuery work properly cross-frame you will generally need an instance of jQuery in both windows, and you should only use the corresponding instance of jQuery ($) to interact with each window.</p> <p><strong>eta re comment:</strong></p> <p>OK, having looked into <code>mousewheel</code> further, I don't know how your code can be working in Firefox (it certainly doesn't for me). Firefox doesn't support <code>mousewheel</code> events at all; instead it supports <code>DOMMouseScroll</code> events. Also for the other browsers that support <code>mousewheel</code>, it should be bound to a DOM Node rather than the window. So I guess what you're looking for is:</p> <pre><code>if ('MouseScrollEvent' in window) { $(document).bind('DOMMouseScroll', function(event) { return scroll(event.detail*-40); }); } else { $(document).bind('mousewheel', function(event) { return scroll(event.wheelDelta); }); } function scroll(d) { window.scrollBy(-d, 0); return false; }; </code></pre> <p>(However in WebKit this will stop scrolling when the mouse moves out of the horizontal area corresponding to the viewport width. You may prefer to bind the events to the wider element like the div, if it fills the browser.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload