html页面标尺,canvas实现标尺.html

刻度尺

* {

margin: 0;

padding: 0;

box-sizing: border-box;

}

.ruler-wrap {

width: 100%;

max-width: 600px;

/*height: 60px;*/

line-height: 1px;

overflow: hidden;

margin: 0 auto 50px;

}

.text-input{

display: block;

width: 100px;

height: 30px;

border-radius: 5px;

background: #f6f6f6;

border: none;

text-align: center;

font-size: 14px;

color: #4142cc;

font-weight: bold;

letter-spacing: 1px;

margin: 0 auto;

}

.text-input:focus{

outline: none;

}

//调用刻度尺方法

ruler.initPlugin({

el: "ruler", //容器id

startValue: 100,

background: "#f5f5f5",

success: function(res) {

console.log(res);

}

});

//调用刻度尺方法

ruler.initPlugin({

el: "ruler2", //容器id

maxScale: 300, //最大刻度

startValue: 50, //刻度开始的初始值

region: [10, 200], //选择刻度的区间范围

background: "#2bd4bc", //刻度尺背景色

markColor: "#c968ff", //中心刻度标记颜色

success: function(res) {

console.log(res);

}

});

var rulerText3 = document.getElementById("rulerText3");

rulerText3.value = 200;

//调用刻度尺方法

ruler.initPlugin({

el: "ruler3", //容器id

height: 50, //刻度尺高度

maxScale: 300, //最大刻度

startValue: 200, //刻度开始的初始值

region: [50, 220], //选择刻度的区间范围

background: "#ffa43c", //刻度尺背景色

color: "#fff", //刻度线和字体的颜色

markColor: "#3786db", //中心刻度标记颜色

isConstant: true, //是否不断地获取值

success: function(res) {

console.log(res);

rulerText3.value = res;

}

});

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值