一个支持IE的html滑动条_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:48:40
Original
874 people have browsed it

<html><script type="text/javascript" src="jquery.js"></script><style>.d_b{	height: 20px;	width: 10px;	display: inline-block;	background-color: black;	position: relative;	vertical-align: middle;	top: -15px;	left: -5px;}</style><div id="d" style="width:200px;cursor: pointer;" max=100 min=0 value=10 ><div style="height:10px; width:100%; background-color:green" ></div><b class="d_b"></b></div><b id="text"></b><script>var $dom = $(document);$dom.on('mousedown','#d',function (argument) {	$(this).data('mouse','down');	console.log('down');})$dom.on('mouseup',function(){	$('#d').data('mouse','up');	console.log('up');});$dom.on('mousemove','#d',function(event){	if($(this).data('mouse') == 'down'){		var m_x = event.clientX;				var d_b = $(this).find('.d_b');		m_x = m_x < 8 ? 8 : m_x;		m_x = m_x > 208 ? 208: m_x;		d_b.css('left',m_x-13);				var max = $(this).attr('max');		$(this).attr('value', Math.floor((m_x-8)/200 * max))		console.log($(this).attr('value'));		$('#text').text($(this).attr('value'))	}});</script></html>
Copy after login

效果图:


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!