Permalink
Browse files

add support for old event.detail property

  • Loading branch information...
eskimoblood committed May 10, 2012
1 parent de49560 commit 77dc0fc3c0801c110afa769886a7dabc641c7ade
Showing with 7 additions and 5 deletions.
  1. +7 −5 js/jquery.knob-1.0.1.js
View
@@ -140,19 +140,21 @@ $(function() {
var keys={37: -1, 38:1, 39:1, 40: -1}
$this.keydown(function(event){
- setVal( keys[event.keyCode])
+ setVal( keys[event.keyCode]);
+ event.preventDefault();
});
$this.bind('mousewheel DOMMouseScroll', function(event){
- var deltaX = event.originalEvent.wheelDeltaX;
- var deltaY = event.originalEvent.wheelDeltaY;
+ var originalEvent = event.originalEvent;
+ var deltaX = originalEvent.detail || originalEvent.wheelDeltaX;
+ var deltaY = originalEvent.detail || originalEvent.wheelDeltaY;
+ setVal( deltaX > 0 || deltaY > 0 ? 1 : deltaX < 0 || deltaY < 0 ? -1 : 0);
event.preventDefault();
- setVal( deltaX > 0 || deltaY > 0 ? 1 : deltaX < 0 || deltaY < 0 ? -1 : 0)
});
function setVal(dir){
if(dir){
- k.val( parseInt($this.val()) + dir )
+ k.val( parseInt($this.val()) + dir );
}
}
}

0 comments on commit 77dc0fc

Please sign in to comment.