 
						如果你也在寻找一款生成漂亮旋钮(knob)的jQuery插件的话,那么今天我们介绍的jQuery knob肯定是一个不错的选择。它使用canvas帮助我们生成超酷的旋钮特效,你可以使用插件选项或者HTML5的data属性来自定义设置插件属性,方便简捷并且优雅,我相信大家肯定会喜欢这个超酷的jQuery插件,如果你有任何问题活着建议请给我们留言!
支持只读模式
两个供选择的callback方法:change和release
支持自定义选项并且支持使用HTML5的data属性来配置插件选项
内建不同的主题
对于老的浏览器拥有不错的fallback机制
导入jQuery和knob插件类库:
| 1 2 | <scriptsrc="js/jquery.knob-1.0.1.js"></script> | 
设定参数和callback方法:
| 1 2 3 4 5 6 7 8 9 10 | $(".knob").knob({    max: 940,    min: 500,    thickness: .3,    fgColor: '#2B99E6',    bgColor: '#303030',    'release':function(e){        $('#img').animate({width:e});    }}); | 
当然,你也可以使用HTML5的标签属性来设置参数,如下:
| 1 | <inputclass="knob2"data-width="150"data-fgColor="green"data-bgColor="#303030"data-skin="tron"data-thickness=".3"data-min="200"data-max="600"value="200"> | 
演示代码
HTML代码
| 1 2 3 4 5 6 | <divid="knobwrapper">    <inputclass="knob"data-width="300"data-skin="tron"data-displayInput="true"value="200">    <div>    <inputclass="knob2"data-width="150"data-fgColor="green"data-bgColor="#303030"data-skin="tron"data-thickness=".3"data-min="200"data-max="600"value="200">    </div></div> | 
Javascript代码
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | $(function() {    $(".knob").knob({        max: 940,        min: 500,        thickness: .3,        fgColor: '#2B99E6',        bgColor: '#303030',        'release':function(e){            $('#img').animate({width:e});        }    });        $(".knob2").knob({        'release':function(e){            $('#img').animate({width:e});        }    });}); | 
CSS代码
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | body{    background: #202020;}header{    margin: 0auto;    width: 960px;    color: #808080;    font-weight: bold;    font-family: Arial;}header h1{    font-size: 44px;}#container{    margin: 0auto;    padding:0;    width: 960px;    border: 10pxsolid#303030;    border-radius: 5px5px5px5px;    background: #000;    box-shadow: 0px0px30px#2B99E6;}#imgwrapper{    width: 460px;    float: left;    text-align: center;    padding:0;    margin:0;}#knobwrapper{    width: 300px;    float: right;    text-align: center;}#img{    margin: 0auto;    width: 500px;    border-radius: 5px5px5px5px;}.clear{    clear:both;} | 
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com