jQuery實(shí)現(xiàn)的數(shù)值范圍range2dslider選取插件特效多款代碼分享
本文實(shí)例講述了jQuery實(shí)現(xiàn)的數(shù)值范圍range2dslider選取插件特效。分享給大家供大家參考。具體如下:
這是是一款簡(jiǎn)單的jquery插件,使用該插件后實(shí)現(xiàn)鼠標(biāo)可以滑動(dòng)(拖動(dòng))控制數(shù)值范圍選取的特效代碼。
運(yùn)行效果圖: -------------------查看效果 下載源碼-------------------

小提示:瀏覽器中如果不能正常運(yùn)行,可以嘗試切換瀏覽模式。
為大家分享的jQuery實(shí)現(xiàn)的數(shù)值范圍選取特效代碼如下
<!doctype html>
<html lang="en">
<head>
<meta charset="gb2312">
<title>jQuery數(shù)值范圍選取插件range2dslider </title>
<script type="text/javascript" src="jquery.js"></script>
<link rel="stylesheet" href="jquery.range2dslider.css">
<script type="text/javascript" src="jquery.range2dslider.js"></script>
<style>
body,html{
margin:0px;
padding:0px;
}
ul{
margin:0px 0px;
padding:10px 25px;
}
body>div{
margin:0px 20px;
padding:20px;
background:rgba(184, 184, 184, 0.1);
}
</style>
</head>
<body>
<div>
<h2>簡(jiǎn)單的二維滑塊</h2>
<input id="slider">
<script>
window.onerror = function(msg, url, linenumber) {
alert('Error message: '+msg+'\nURL: '+url+'\nLine Number: '+linenumber);
return true;
}
$('#slider').range2DSlider({
grid:true,
axis:[[1,2,5,7,10],[2,5,10]],
projections:true,
showLegend:[1,1],
allowAxisMove:['both'],
printLabel:function( val ){
this.projections&&this.projections[0].find('.xdsoft_projection_value_x').text(val[1].toFixed(5));
return val[0].toFixed(5);
}
})
.range2DSlider('value',[[0,1],[3,0],[6,6]]);
$('#slider')
.range2DSlider();
</script>
<h2>水平滑塊</h2>
<input id="slider1">
<script>
$('#slider1').range2DSlider({
template:'horizontal',
value:[[5,0],[7,0]],
onlyGridPoint:true,
round:true,
axis:[[-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10]]
});
</script>
<h2>垂直滑塊</h2>
<input class="slider2">
<input class="slider2">
<input class="slider2">
<input class="slider2">
<input class="slider2">
<input class="slider2">
<div style="clear:both;float:none;"></div>
<script>
$('.slider2').range2DSlider({
template:'vertical',
value:[[0,5]],
showRanges:[[0,1]],
style:'float:left;margin-left:25px;',
axis:[[0,1],[0,10]],
round:true,
printLabel:function( val ){
return val[1]+' yo';
}
});
</script>
<h2>平滑滑塊(x)</h2>
<input class="slider3">
<script>
var values = [];
var ranges = [];
var cities = [
'Abuja',
'Accra',
'Adamstown',
'Addis',
'Algiers',
'Alofi',
'Amman',
'Amsterdam',
'Andorra',
'Ankara',
'Antananarivo',
'Apia',
'Ashgabat',
'Asmara',
'Astana',
'Asuncion',
'Athens',
'Avarua',
'Baghdad',
'Baku',
'Bamako',
'Bandar',
'Bangkok',
'Bangui',
'Banjul',
'Basseterre',
'Beijing',
'Beirut',
'Belgrade',
'Belmopan'
];
for(var i = -10,k=0;i<=10;i++,k++ ){
values.push([i,Math.sin(i),cities[i+10]]);
if( i<10 )
ranges.push([k,k+1]);
}
$('.slider3').range2DSlider({
x:'right',
y:'top',
showLegend:[0,0],
showRanges:ranges,
axis:[[-10,10],[-1.5,1.5]],
allowAxisMove:['y'],
printLabel:function( val ){
return val[1].toFixed(2)+'<br>'+val[2];
}
}).range2DSlider('value',values);
</script>
<h2>自定義風(fēng)格滑塊</h2>
<input id="slider4">
<style>
.xdsoft_custom .xdsoft_range2dslider_runner{
border-radius:1px;
margin:0px 0px -4px -8px !important;
background:rgba(0,0,127,0.5);
border:1px outset #ddd;
}
.xdsoft_custom .xdsoft_range2dslider_box{
min-height:8px;
background:rgba(127,127,127,0.5);
border-radius:1px;
border-style:solid;
}
.xdsoft_custom .xdsoft_slider_label{
background: red;
color: #fff;
bottom: 22px !important;
}
.xdsoft_custom .xdsoft_slider_label.xdsoft_slider_label_top:after{
border-top-color:red;
}
</style>
<script>
$('#slider4').range2DSlider({
grid:false,
height:0,
className:'xdsoft_custom',
showLegend:[1,0],
axis:[[0,0.1]],
tooltip:['top'],
alwShowTooltip:[true],
allowAxisMove:['x'],
printLabel:function( val ){
return val[0].toFixed(3);
}
}).range2DSlider('value',[[0.05,0]]);
</script>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>適用瀏覽器:360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗. 不支持IE8及以下瀏覽器。</p>
</div>
</body>
</html>
以上就是為大家分享的jQuery實(shí)現(xiàn)的數(shù)值范圍選取特效代碼,希望大家可以喜歡。
相關(guān)文章
jquery基礎(chǔ)教程之deferred對(duì)象使用方法
jquery基礎(chǔ)教程之deferred對(duì)象使用方法2014-01-01
使用jquery實(shí)現(xiàn)select添加實(shí)現(xiàn)后臺(tái)權(quán)限添加的效果
使用jquery實(shí)現(xiàn)select添加實(shí)現(xiàn)后臺(tái)權(quán)限添加的效果,需要的朋友可以參考下。2011-05-05
jquery實(shí)現(xiàn)點(diǎn)擊左右按鈕切換圖片
這篇文章主要為大家詳細(xì)介紹了jquery實(shí)現(xiàn)點(diǎn)擊左右按鈕切換圖片,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-01-01
JQuery實(shí)現(xiàn)折疊式菜單的詳細(xì)代碼
這篇文章主要介紹了JQuery實(shí)現(xiàn)折疊式菜單的詳細(xì)代碼,本文通過(guò)實(shí)例代碼通過(guò)兩種風(fēng)格給大家詳細(xì)介紹,需要的朋友可以參考下2020-06-06
基于Jquery插件開(kāi)發(fā)之圖片放大鏡效果(仿淘寶)
公司某個(gè)網(wǎng)站,需要實(shí)現(xiàn)圖片預(yù)覽效果,并能像淘寶一樣實(shí)現(xiàn)局部分大,使用jquery的朋友可以參考下。2011-11-11
基于jQuery實(shí)現(xiàn)音樂(lè)播放試聽(tīng)列表
這篇文章主要介紹了基于jQuery實(shí)現(xiàn)音樂(lè)播放試聽(tīng)列表的相關(guān)資料,需要的朋友可以參考下2016-04-04
jquery遍歷table的tr獲取td的值實(shí)現(xiàn)方法
下面小編就為大家?guī)?lái)一篇jquery遍歷table的tr獲取td的值實(shí)現(xiàn)方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05
jQuery中(function(){})()執(zhí)行順序的理解
function的順序是這樣的:先計(jì)算第一個(gè)小括號(hào),發(fā)現(xiàn)里面的表達(dá)式是一個(gè)函數(shù),返會(huì)該匿名函數(shù)的引用(指針),最后一個(gè)括號(hào)則是建立匿名函數(shù)的實(shí)參和并執(zhí)行,感興趣的你可以參考下本文2013-03-03

