>  기사  >  웹 프론트엔드  >  一个支持IE的html滑动条_html/css_WEB-ITnose

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

WBOY
WBOY원래의
2016-06-24 11:48:40875검색

<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>

效果图:


성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.