Skip to content

Commit

Permalink
Remove dependency on jQuery event/alias module
Browse files Browse the repository at this point in the history
  • Loading branch information
arschmitz committed Jul 1, 2015
1 parent ddcb162 commit ef13e9c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
4 changes: 2 additions & 2 deletions jquery.mousewheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@

$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
return fn ? this.on('mousewheel', fn) : this.trigger('mousewheel');
},

unmousewheel: function(fn) {
return this.unbind('mousewheel', fn);
return this.off('mousewheel', fn);
}
});

Expand Down
12 changes: 6 additions & 6 deletions jquery.mousewheel.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 16 additions & 4 deletions test/browserify/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<script src="bundle.js"></script>
<script>
$(document).bind('mousewheel', function(e) { console.log(e); });
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Mouse Wheel - Browserify Test</title>
<script src="bundle.js"></script>
<script>
$(function(){
$(document).on('mousewheel', function(e) { console.log(e); });
});
</script>
</head>
<body>

</body>
</html>
2 changes: 1 addition & 1 deletion test/scroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$('#emulated').append(html);
$('#native').append(html);
}
$('#emulated').bind('mousewheel', function(event) {
$('#emulated').on('mousewheel', function(event) {
event.preventDefault();
var scrollTop = this.scrollTop;
this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -1));
Expand Down

0 comments on commit ef13e9c

Please sign in to comment.