I am having trouble animating jquery knob. As you can see in my example only the last one animates.
<input class="knob nummer1 animated" value="0" rel="64">
<input class="knob nummer2 animated" value="0" rel="77">
<input class="knob nummer3 animated" value="0" rel="99">
local $this
object was not getting set for every new instance of knob,instead same this
object was referenced each time.
so what you need to do is create a new local reference of this
object for every knob instance.
var $this = $(this);
JS CODE:
$('.knob').each(function() {
var $this = $(this);
var myVal = $this.attr("rel");
$this.knob({
});
$({
value: 0
}).animate({
value: myVal
}, {
duration: 2000,
easing: 'swing',
step: function() {
$this.val(Math.ceil(this.value)).trigger('change');
}
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.