您好,欢迎访问一九零五行业门户网

Jquery实现弹性滑块滑动选择数值插件_jquery

做了一个类似于阿里云弹性计算中的滑块效果,可以自由滑动滑块,并且计算刻度。基于jquery实现,小伙伴们不要忘记载入jquery哦
css
.main { margin: 0 auto; margin-top: 100px; width: 500px; font-family: 微软雅黑; -webkit-user-select: none;}.contain { width: 500px; height: 40px; background-color: #e8e8e8;}.track { width: 16px; height: 46px; position: absolute; margin: -3px 0 0 0px; background-color: #2dacd1; cursor: pointer;}.valuec { height: 40px; position: absolute; margin: 0; background-color: #43bfe3;}.value span { position: absolute; text-align: right; height: 40px; line-height: 40px; color: #808080; border-right: 1px solid #dddddd;}.show { width: 45px; height: 30px; background-color: #333; color: #fff; text-align: center; line-height: 30px; position: absolute; opacity: 0.9; margin-top: -38px; margin-left: -15px;}
html
0

js

演示图:
演示地址:http://demo.jb51.net/js/2015/jquery-txhk/
另外推荐一款范围选择器插件jrange,它是基于jquery的一款简单插件。下面我们来看下插件jrange的使用。
html
首先载入jquery库文件以及jrange相关的css文件:jquery.range.css和插件:jquery.range.js

然后在需要展示滑块选择器的位置放入以下代码:

我们使用了hiiden类型的文本域,设置默认值value,如23。
jquery
调用jrange插件非常简单,直接用下面的代码:
$('.single-slider').jrange({ from: 0, to: 100, step: 1, scale: [0,25,50,75,100], format: '%s', width: 300, showlabels: true, showscale: true });
更多信息请参阅jrange项目官网:https://github.com/nitinhayaran/jrange
其它类似信息

推荐信息