Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make changes in the 1.1.o file revert changes in 1.0.1 file

  • Loading branch information...
commit 66921ff1b89f829494009f223434c484d421d792 1 parent f225af2
@eskimoblood eskimoblood authored
Showing with 13 additions and 51 deletions.
  1. +4 −47 js/jquery.knob-1.0.1.js
  2. +9 −4 js/jquery.knob-1.1.0.js
View
51 js/jquery.knob-1.0.1.js
@@ -131,18 +131,15 @@ $(function() {
}
);
-
k = new Knob( c, opt );
k.onRelease = function(v) {
opt.release(v,$this);
};
k.val( parseInt($this.val()) || 0 );
-
- k.onChange = function(v){
- var limitedValue = limitValue(v);
- $this.val(limitedValue);
- opt.change(limitedValue);
- }
+ k.onChange = function(v) {
+ $this.val(v);
+ opt.change(v);
+ };
// bind change on input
$this.bind(
@@ -163,46 +160,6 @@ $(function() {
}else{
$this.attr('readonly','readonly');
}
-
- var keys={37: -1, 38:1, 39:1, 40: -1}
-
- $this.keydown(function(event){
- setVal( keys[event.keyCode]);
- event.preventDefault();
- });
-
- $this.bind('mousewheel DOMMouseScroll', function(event){
- var originalEvent = event.originalEvent;
- var deltaY, deltaX;
-
- if ( originalEvent.wheelDelta ) { delta = originalEvent.wheelDelta }
- if ( originalEvent.detail ) { delta = -originalEvent.detail }
-
- // New school multidimensional scroll (touchpads) deltas
- deltaY = delta;
-
- // Gecko
- if ( originalEvent.axis !== undefined && originalEvent.axis === originalEvent.HORIZONTAL_AXIS ) {
- deltaY = 0;
- deltaX = -1*delta;
- }
-
- // Webkit
- if (originalEvent.wheelDeltaY !== undefined ) { deltaY = originalEvent.wheelDeltaY; }
- if (originalEvent.wheelDeltaX !== undefined ) { deltaX = -1*originalEvent.wheelDeltaX; }
- setVal( deltaX > 0 || deltaY > 0 ? 1 : deltaX < 0 || deltaY < 0 ? -1 : 0);
- event.preventDefault();
- });
-
- function setVal(dir){
- if(dir){
- k.val( (limitValue(parseInt($this.val()) + dir) ));
- }
- }
-
- function limitValue(v){
- return limitedValue = Math.max(Math.min(v, opt.max), opt.min);
- }
}
).parent();
}
View
13 js/jquery.knob-1.1.0.js
@@ -162,9 +162,10 @@ $(function() {
};
k.val( parseInt($this.val()) || 0 );
k.onChange = function(v) {
- $this.val(v);
- opt.change(v);
- };
+ var limitedValue = limitValue(v);
+ $this.val(limitedValue);
+ opt.change(limitedValue);
+ };
// bind change on input
$this.bind(
@@ -202,9 +203,13 @@ $(function() {
function setVal(dir){
if(dir){
- k.val( parseInt($this.val()) + dir );
+ k.val( (limitValue(parseInt($this.val()) + dir) ));
}
}
+
+ function limitValue(v){
+ return limitedValue = Math.max(Math.min(v, opt.max), opt.min);
+ }
}
).parent();
}
Please sign in to comment.
Something went wrong with that request. Please try again.