[英]Jquery knob animate
我無法動畫jquery旋鈕。 正如您在我的示例中所看到的,只有最后一個動畫。
<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">
當地$this
對象沒有得到對旋鈕的每一個新的實例設置,而不是同this
對象每次都被引用。
所以你需要做的是為每個旋鈕實例創建一個this
對象的新本地引用。
var $this = $(this);
JS代碼:
$('.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');
}
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.