Skip to content

Commit f7d64c7

Browse files
committed
Use .on/.off for event binding, thanks @ayumihamsaki
Closes #201
1 parent 72434ca commit f7d64c7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

jquery.mousewheel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@
8484

8585
$.fn.extend( {
8686
mousewheel: function( fn ) {
87-
return fn ? this.bind( "mousewheel", fn ) : this.trigger( "mousewheel" );
87+
return fn ? this.on( "mousewheel", fn ) : this.trigger( "mousewheel" );
8888
},
8989

9090
unmousewheel: function( fn ) {
91-
return this.unbind( "mousewheel", fn );
91+
return this.off( "mousewheel", fn );
9292
}
9393
} );
9494

jquery.mousewheel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/unit.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ QUnit.test( ".mousewheel() shorthand", function( assert ) {
3030
markup.mousewheel( function( e ) {
3131
assert.ok( true, "triggered a mousewheel event on " + e.target.innerText );
3232
} );
33-
markup.trigger( "mousewheel" );
33+
markup.mousewheel();
34+
35+
// Should not trigger another event
36+
markup.unmousewheel();
37+
markup.mousewheel();
3438

3539
markup.remove();
3640
} );

0 commit comments

Comments
 (0)