Alex Berd Alex Berd - 1 year ago 39
jQuery Question

Firefox mousewheel type event in jquery recognized as resize

I bind window to next events:

$(window).on('mousewheel keydown resize', function(ev) {});

This code works fine in Chrome, ev.type on mousewheel is 'mousewheel'

However, in Firefox ev.type is 'resize'.

JSFIDDLE (JSFIDDLE is responsive to resize, thus no mousewheel, but can be checked in any other page)

Is there is known bug in FF or I missed something.

Answer Source

Use following code to get mouse scroll event in firefox.

$(window).bind('DOMMouseScroll mousewheel keydown resize', function(ev) {alert(ev.type)})

In firefox you will need DOMMouseScroll event.

Here is updated fiddle.