我正在尝试使用knob.js
在wordpress中添加循环计数器这是一个例子
jQuery('.knob').each(function () {
var $this = $(this);
var myVal = $this.attr("rel");
// alert(myVal);
$this.knob({
});
$({
value: 0
}).animate({
value: myVal
}, {
duration: 2000,
easing: 'swing',
step: function () {
$this.val(Math.ceil(this.value)).trigger('change');
}
})
});
样本 http://jsfiddle.net/bowenac/eea52/
这是knob.js文件 https://raw.github.com/aterrien/jQuery-Knob/master/js/jquery.knob.js
我根本无法在wordpress中使用它。有人在wordpress中使用了knob.js吗?
提前致谢。
答案 0 :(得分:0)
我搞定了......我忘了添加jQuery并且必须编辑knob.js以及最终使用它。
jQuery(document).ready(function($) {
$('.knob').each(function() {
var $this = $(this);
var myVal = $this.attr("rel");
// alert(myVal);
$this.knob({
});
$({
value: 0
}).animate({
value: myVal
}, {
duration: 2000,
easing: 'swing',
step: function () {
$this.val(Math.ceil(this.value)).trigger('change');
}
})
});
});