Permalink
Browse files

Merge pull request #2 from sudodoki/master

Animation in separate function.
  • Loading branch information...
2 parents bee59f4 + 7e17de2 commit d69ad0d5742d3b138403d9caf326be18cc00e84c @nikorablin committed Oct 21, 2012
Showing with 5 additions and 6 deletions.
  1. +4 −5 jquery.slideControl.js
  2. +1 −1 jquery.slideControl.min.js
View
@@ -38,6 +38,7 @@
var containerWidth = container.outerWidth() + 1;
var handleWidth = $(handle).outerWidth();
var offset = $(container).offset();
+ var animate = function(value){$(fill).animate({ width: value + "%"}, o.speed);}
$(window).resize(function() {
offset = $(container).offset();
@@ -53,9 +54,7 @@
e.preventDefault();
position = checkBoundaries(Math.round(((e.pageX - offset.left + handleWidth/2)/containerWidth)*100));
- $(fill).animate({
- width: position + "%"
- }, o.speed);
+ animate(position);
$(input).val(position/10);
});
@@ -84,7 +83,7 @@
$(input).val(o.upperBound);
else if ($(this).val() < o.lowerBound)
$(input).val(o.lowerBound);
- $(fill).width(value + "%");
+ animate(value);
});
});
@@ -112,4 +111,4 @@
}
return this;
}
-})(jQuery);
+})(jQuery);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit d69ad0d

Please sign in to comment.