• 利用定时器实时显示<input type="range"/>的值


    <!doctype html>
    <html lang="en">
    
    	<head>
    		<meta charset="UTF-8" />
    		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    		<title>Document</title>
    		<script type="text/javascript" src="jquery-2.2.4.min.js"></script>
    
    		<style type="text/css">
    			input[type="range"] {
    				 80%;
    				background-color: red;
    				border-radius: 15px;
    				-webkit-appearance: none;
    				height: 1px;
    				position: relative;
    				-webkit-box-sizing: border-box;
    				-moz-box-sizing: border-box;
    				box-sizing: border-box;
    			}
    			
    			input[type="range"]::-webkit-slider-thumb {
    				-webkit-appearance: none;
    				background-color: green;
    				border-radius: 50%;
    				height: 30px;
    				 30px;
    				box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    				border: none;
    				position: relative;
    				z-index: 10;
    			}
    		</style>
    		<script type="text/javascript">
    			$(function() {
    				$(".input_1").change(function() {
    					$("p.p1").text($(this).val());
    				})
    
    				setInterval(function() {
    					$("p.p2").text($(".input_2").val());
    				}, 0.01)
    			})
    		</script>
    	</head>
    
    	<body>
    		<p>添加change事件</p>
    		<input type="range" class="input_1" step="0.01" min="0" max="5" value="0">
    		<p class="p1">0</p>
    		<p>添加定时器</p>
    		<input type="range" class="input_2" step="0.01" min="0" max="5" value="0">
    		<p class="p2">0</p>
    	</body>
    
    </html>
  • 相关阅读:
    python学习
    androidandroid中的通过网页链接打开本地app
    Android自定义View之绘制虚线
    Backbone学习记录(3)
    Backbone学习记录(2)
    Backbone学习记录(1)
    网络时间轴中竖线的含义
    控制台笔记
    css hack 笔记
    Fiddler学习笔记
  • 原文地址:https://www.cnblogs.com/libin-1/p/5567029.html
Copyright © 2020-2023  润新知