event.offsetX in Firefox

From a JQuery bug tracker page – a nice polyfill is this:

var offX  = (e.offsetX || e.pageX - $(e.target).offset().left);

.. where e is the event returned from a jquery event. Obviously, only if you’ve got Jquery already on your project, otherwise will have to do the offset() stuff manually.

Leave a Comment