jQuery实现移动端滑块拖动选择数字效果
作者:bea
本文为大家分享了基于jquery ui实现的一个精美实用的效果,可以通过鼠标拖拽滑动效果来选择数字,供大家参考,具体内容如下 运行效果图: 实现代码: <html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="gb2312"><title>demo</title><link rel="stylesheet" href="http://c
本文为大家分享了基于jquery ui实现的一个精美实用的效果,可以通过鼠标拖拽滑动效果来选择数字,供大家参考,具体内容如下
运行效果图:
实现代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="gb2312">
<title>demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<style>
.slider-box{ background:#F0EFEB; font-family:Microsoft Yahei; padding-bottom:10px}
.slider-box .item{ padding:10px}
.slider-box .item .tag, .slider-box .item .slider, .slider-box .item .val{ float:left; margin-right:18px}
.slider-box .item .slider{ width:400px}
.slider-box .item .slider div{ background:#8FBF0B; border:none; height:0.5em; margin-top:0.5em}
.slider-box .item .slider div .ui-slider-handle{ background:#F4F3F1; width:1em; height:1em; border-radius:1em}
.slider-box .item .val input{ border:none; border-bottom:1px solid #ABADA8; background:none; padding:0.1em 1em; color:#E4531C; font-weight:bold; font-size:1em; width:5em; text-align:center}
.clr{ clear:both}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
<div class="slider-box">
<div class="item">
<div class="tag">骑行里程:</div>
<div class="slider">
<div id="budget"></div>
</div>
<div class="val"><input value="8800" name="budget" /></div>
</div>
<div class="clr"></div>
<div class="item">
<div class="tag">骑行天数:</div>
<div class="slider">
<div id="days"></div>
</div>
<div class="val"><input value="9" name="days" /></div>
</div>
<div class="clr"></div>
</div>
<script>
$("#budget").slider({
min: 2000,
max: 17000,
step: 100,
value: $('input[name="budget"]').val(),
slide: function( event, ui ) {
$('input[name="budget"]').val(ui.value)
}
});
$("#days").slider({
min: 1,
max: 20,
value: $('input[name="days"]').val(),
slide: function( event, ui ) {
$('input[name="days"]').val(ui.value)
}
});
</script>
</body>
</html>
以上就是jQuery实现移动端滑块拖动选择数字效果的代码,希望对大家的学习有所帮助。
有用 | 无用
运行效果图:
实现代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="gb2312">
<title>demo</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<style>
.slider-box{ background:#F0EFEB; font-family:Microsoft Yahei; padding-bottom:10px}
.slider-box .item{ padding:10px}
.slider-box .item .tag, .slider-box .item .slider, .slider-box .item .val{ float:left; margin-right:18px}
.slider-box .item .slider{ width:400px}
.slider-box .item .slider div{ background:#8FBF0B; border:none; height:0.5em; margin-top:0.5em}
.slider-box .item .slider div .ui-slider-handle{ background:#F4F3F1; width:1em; height:1em; border-radius:1em}
.slider-box .item .val input{ border:none; border-bottom:1px solid #ABADA8; background:none; padding:0.1em 1em; color:#E4531C; font-weight:bold; font-size:1em; width:5em; text-align:center}
.clr{ clear:both}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
<div class="slider-box">
<div class="item">
<div class="tag">骑行里程:</div>
<div class="slider">
<div id="budget"></div>
</div>
<div class="val"><input value="8800" name="budget" /></div>
</div>
<div class="clr"></div>
<div class="item">
<div class="tag">骑行天数:</div>
<div class="slider">
<div id="days"></div>
</div>
<div class="val"><input value="9" name="days" /></div>
</div>
<div class="clr"></div>
</div>
<script>
$("#budget").slider({
min: 2000,
max: 17000,
step: 100,
value: $('input[name="budget"]').val(),
slide: function( event, ui ) {
$('input[name="budget"]').val(ui.value)
}
});
$("#days").slider({
min: 1,
max: 20,
value: $('input[name="days"]').val(),
slide: function( event, ui ) {
$('input[name="days"]').val(ui.value)
}
});
</script>
</body>
</html>
以上就是jQuery实现移动端滑块拖动选择数字效果的代码,希望对大家的学习有所帮助。
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- 借助FileReader实现将文件编码为Base64后通过AJAX上传
- javascript与jquery中的this关键字用法实例分析
- JS实现部分HTML固定页面顶部随屏滚动效果
- jQuery中hover与mouseover和mouseout的区别分析
- 基于JS2Image实现圣诞树代码
- jquery读写cookie操作实例分析
- jquery.cookie实现的客户端购物车操作实例
- jQuery基于cookie实现的购物车实例分析
- jQuery实现网页顶部固定导航效果代码
- 基于jQuery实现左右图片轮播(原理通用)
- jquery捕捉回车键及获取checkbox值与异步请求的方法
- jquery遍历函数siblings()用法实例
- jQuery中的siblings用法实例分析
- JQuery标签页效果实例详解
- 谈谈我对JavaScript原型和闭包系列理解(随手笔记9)
- JQuery实现Ajax加载图片的方法
- 谈谈我对JavaScript原型和闭包系列理解(随手笔记8)
- js中flexible.js实现淘宝弹性布局方案
- 正则表达式优化JSON字符串的技巧