当按下回车键时,我生成了这个图表。我想改用一个简单的按钮:http: //www.cb-dev.tk/A/
这是 init.js 文件:
$(function(){
var input = $('.input'),
bar = $('.bar'),
bw = bar.width(),
percent = bar.find('.percent'),
ps = percent.find('span'),
name = 'rotate';
input.on('keydown', function(e){
if (e.keyCode == 13){
var t = $(this), val = t.val();
if (val >=0 && val <= 1000){
var w = 1000-val, pw = (bw*w)/1000,
pa = {
width: w/10+'%'
},
cw = (bw-pw)/2,
ca = {
left: cw
}
ps.animate(pa);
}
}
});
});
怎么做 ?