html5中input有增加type=range。这为拖动滑块提供了很大的便利。下面是他的属性:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.main{ position: relative;width: 500px;}
#range {
-webkit-appearance: none;
background: #;
height: 3px;
outline: none;
margin: ;
width: 500px;
}
input[type=range]::-webkit-slider-thumb{
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: %;
background: red;
}
p{
position: absolute;
width: 0px;
height: 3px;
background: green;
top: -2px;
left: ;
}
.range{
position: relative;
}
.value{
padding: 10px;
background: #ffebc7;
font-size: 40px;
text-align: center;
margin: auto;
}
</style>
</head>
<body>
<div class="main">
<div class="value"></div>
<div class="range">
<input type="range" max="" min="" id="range" step="0.1" value="">
<p></p>
</div>
</div>
</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(".value").html("")
var rangeSwitch=function () {
var x=$("#range").val();
$("p").css({"width":(x/)**0.96})//乘的0.96是因为要不然绿色的颜色会有部分盖住滑动按钮(500-20)/500=0.96;
$(".value").html(x)
}
$("#range").on("input",rangeSwitch)
</script>
</html>

最新文章

  1. (转)java DecimalFormat用法
  2. SVN Client
  3. React快速入门
  4. PI-webservice06-调用外部webservice过程中注意问题
  5. CF 39E What Has Dirichlet Got to Do with That? (博弈)
  6. 对“demo!demo.Index+HookProc::Invoke”垃圾收集的类型已委托回调。这可能会导致应用程序崩溃、损坏和数据丢失。当传递委托给非托管代码,托管应用程序必须让这些委托保持活着
  7. SQLite错误总结 error code 19: constraint failed
  8. java web 学习笔记 jsp内置对象
  9. Asp.net MVC 填充word并下载
  10. tcp窗口滑动以及拥塞控制(转)
  11. Android存储之SQLite数据库
  12. 云计算openstack共享组件(3)——消息队列rabbitmq
  13. 【jQuery】(2)---Jquery过滤选择器
  14. 深入理解Python中赋值、深拷贝(deepcopy)、浅拷贝(copy)
  15. SSM项目搭建
  16. 解决 .net core 中 nuget 包版本冲突问题
  17. 注解@RestController与@Controller的区别
  18. .Net Core创建Docker镜像
  19. 数学:确定性的丧失 (M&#183;克莱因 著)
  20. RV32A指令集

热门文章

  1. 洛谷p1007独木桥
  2. eclipse Tomcat 启动报错
  3. C++之const类成员变量,const成员函数
  4. FFmpeg+FFserver流媒体服务器介绍
  5. 将List&lt;T&gt;集合用DataGridView展示
  6. sparkContext之一:sparkContext的初始化分析
  7. hibernate的优缺点和适用场合
  8. HTML5.与JQUERY与AJAX常见面试题
  9. Broken robot
  10. SpringMVC配置字符过滤器的两种方式