Is there a way to animate the slider using jQuery? I want to be able to press a button and have the inner part of the slider move slower (e.g. 300ms) without reacting to mouse clicks and slides.
Here is the code: http://jsfiddle.net/gm4tG/5/
HTML:
<div id='slider' class='sliderBar'></div>
<button>Remove 10%</button>
CSS:
html, body {
height:100%;
width:100%;
margin:0;
padding:0;
}
#slider {
height:20px;
max-height:20px;
}
.sliderBar-progress {
background:rgb(0, 255, 0);
}
JS:
$('#slider').sliderBar({
start: 100,
onChange: function (val) {
var red = 0,
green = 0;
if (val >= 50) {
red = 255 - Math.round(((val - 50) / 50) * 255);
green = 255;
} else {
red = 255;
green = Math.round(((val) / 50) * 255);
}
$('.sliderBar-progress').css({
background: "rgb(" + red + "," + green + ",0)"
});
}
});
$('button').on('click', function () {
$('#slider').setsliderBar($('#slider').getsliderBar()-10, true);
});
Thank You very much!