JQuery Knob display number change(JQuery Knob显示数字变化)
问题描述
我正在使用 JQuery Knob 来制作一些很酷的图表,而且效果很好.但是我有一个问题:我想让图表之间的显示数字连接一个'%'符号.但我似乎无法让它发挥作用.通过 jquery 修改输入不会这样做,我已经尝试读入库的代码但没有运气.有没有其他人遇到过这个问题?
I'm using JQuery Knob to make some cool graphs and it's working perfectly. But I have one problem: I want to make the display number between the graph have a '%' symbol concatenated. but I just cant seem to make it work. Modifying the input through jquery wont do it, and I've tried reading into the code of the library but with no luck. Has any one else had this problem before?
推荐答案
如果您快速浏览一下 github 存储库,您会发现每次绘制画布时都会调用一个绘制钩子.如果你实现了那个钩子,你应该能够在输入中添加任何你想要的东西.这是您正在寻找的功能的简短示例(尝试一下:http://jsfiddle.net/eAQA2/)和供将来参考:
If you take a quick look at the github repo you'll see that there's a draw hook that's called everytime the canvas is drawn. If you implement that hook you should be able to add whatever you wish to the input. Here's a short example of the functionality you're looking for (to try it: http://jsfiddle.net/eAQA2/ ) and for future reference:
<!DOCTYPE html>
<html>
<head>
<script src="aHR0cDovL2NvZGUuanF1ZXJ5LmNvbS9qcXVlcnktMS44LjIubWluLmpz"></script>
<script src="aHR0cHM6Ly9yYXcuZ2l0aHViLmNvbS9hdGVycmllbi9qUXVlcnktS25vYi9tYXN0ZXIvanMvanF1ZXJ5Lmtub2IuanM="></script>
<script>
$(function() {
$(".dial").knob({
'draw' : function () {
$(this.i).val(this.cv + '%')
}
})
})
</script>
</head>
<body>
<input type="text" class="dial" data-min="0" data-max="100">
</body>
</html>
这篇关于JQuery Knob显示数字变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JQuery Knob显示数字变化
- SoapClient 设置自定义 HTTP Header 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- Laravel 仓库 2022-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01