脚本宝典收集整理的这篇文章主要介绍了javascript代码实例教程-jQuery实现的支持IE的html滑动条,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。
代码如下:
<html>
<script tyPE="text/javascript" src="jquery.js"></script>
<style>
.d_b{
height: 20px;
width: 10px;
dis@R_777_2266@: inline-block;
background-color: black;
posITion: relative;
vertical-align: middle;
top: -15px;
left: -5px;
}
</style>
<p id="d" style="width:200px;cursor: pointer;" max=100 min=0 value=10 >
<p style="height:10px; width:100%; background-color:green" ></p>
<b class="d_b"></b>
</p>
<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>
效果图:
觉得可用,就经常来吧! 脚本宝典 欢迎评论哦! js脚本,巧夺天工,精雕玉琢。小宝典献丑了!
以上是脚本宝典为你收集整理的javascript代码实例教程-jQuery实现的支持IE的html滑动条全部内容,希望文章能够帮你解决javascript代码实例教程-jQuery实现的支持IE的html滑动条所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。