jQuery實(shí)現(xiàn)的支持IE的html滑動條
<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>
效果圖:

以上就是本文的全部內(nèi)容了,希望能夠?qū)Υ蠹覍W(xué)習(xí)使用jQuery有所幫助。
- 用jquery實(shí)現(xiàn)自定義風(fēng)格的滑動條實(shí)現(xiàn)代碼
- 基于jquery的橫向滾動條(滑動條)
- jQuery實(shí)現(xiàn)的網(wǎng)頁豎向菜單效果代碼
- jQuery實(shí)現(xiàn)類似標(biāo)簽風(fēng)格的導(dǎo)航菜單效果代碼
- jQuery實(shí)現(xiàn)下滑菜單導(dǎo)航效果代碼
- jquery實(shí)現(xiàn)動畫菜單的左右滾動、漸變及圖形背景滾動等效果
- jquery實(shí)現(xiàn)的淡入淡出下拉菜單效果
- jquery實(shí)現(xiàn)向下滑出的二級導(dǎo)航下滑菜單效果
- jquery實(shí)現(xiàn)在網(wǎng)頁指定區(qū)域顯示自定義右鍵菜單效果
- jQuery實(shí)現(xiàn)帶滑動條的菜單效果代碼
相關(guān)文章
基于jQuery.Validate驗(yàn)證庫知識點(diǎn)的詳解
本篇文章介紹了,基于jQuery.Validate驗(yàn)證庫知識點(diǎn)的詳解。需要的朋友參考下2013-04-04
jQuery插件HighCharts實(shí)現(xiàn)2D柱狀圖、折線圖的組合多軸圖效果示例【附demo源碼下載】
這篇文章主要介紹了jQuery插件HighCharts實(shí)現(xiàn)2D柱狀圖、折線圖的組合多軸圖效果,結(jié)合實(shí)例形式分析了jQuery使用HighCharts插件同時繪制柱狀圖、折線圖的實(shí)現(xiàn)技巧與相關(guān)操作步驟,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2017-03-03
基于MVC+EasyUI的web開發(fā)框架之使用云打印控件C-Lodop打印頁面或套打報關(guān)運(yùn)單信息
這篇文章主要介紹了基于MVC+EasyUI的web開發(fā)框架之使用云打印控件C-Lodop打印頁面或套打報關(guān)運(yùn)單信息的相關(guān)資料,非常不錯,需要的朋友可以參考下2016-08-08
jQuery 利用$.ajax 時獲取原生XMLHttpRequest 對象的方法
這篇文章主要介紹了jQuery 利用$.ajax 時獲取原生XMLHttpRequest 對象的方法,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-08-08
jQuery實(shí)現(xiàn)布局高寬自適應(yīng)的簡單實(shí)例
下面小編就為大家?guī)硪黄猨Query實(shí)現(xiàn)布局高寬自適應(yīng)的簡單實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-05-05
easyUI實(shí)現(xiàn)類似搜索框關(guān)鍵詞自動提示功能示例代碼
本篇文章主要介紹了easyUI實(shí)現(xiàn)類似搜索框關(guān)鍵詞自動提示功能示例代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下。2016-12-12
jQuery+JSON+jPlayer實(shí)現(xiàn)QQ空間音樂查詢功能示例
本文為大家介紹下jQuery+JSON+jPlayer實(shí)現(xiàn)QQ空間音樂查詢,具體的實(shí)現(xiàn)過程感興趣的朋友可以了解下哈,希望對大家有所幫助2013-06-06

