You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
layui/examples/slider.html

68 lines
1.6 KiB

6 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>滑块 - layui</title>
6 years ago
<link rel="stylesheet" href="../src/css/layui.css">
<style>
body{padding:100px 0;}
</style>
6 years ago
</head>
<body>
<div class="layui-container">
<div id="slideTest1"></div>
<br>
<div id="slideTest2" style="margin: 45px 30px; display: inline-block;"></div>
</div>
6 years ago
<script src="../src/layui.js"></script>
<script>
layui.use('slider', function(){
var slider = layui.slider;
5 years ago
var sliderInst = slider.render({
6 years ago
elem: '#slideTest1'
6 years ago
//,type: 'vertical'
6 years ago
//,min: -20 //最小值
//,max: 20 //最大值
//,value: 11 //[40, 60] //初始值
//,step: 1 //间隔值
6 years ago
//,showstep: true //间隔点
,tips: true //开启提示文本
,tipsAlways: true //开启提示文本始终显示
6 years ago
,input: true //输入框
//,range: true //范围选择
//,theme: '#FF5722'
,change: function(value){ // 选中值发生改变的回调
console.log('change', value)
}
,done: function(value){ // 值完成选中的回调 -- v2.8.0 新增
console.log('done', value);
6 years ago
}
4 years ago
,setTips: function(value){ //自定义提示文本
return value + '%';
}
6 years ago
//,setTips: function(value){ //自定义提示文本
//return '离世界末日还有 ' + value + ' 天';
//}
//,height: '300' //配合 type:'vertical' 参数使用默认200px
//,disabled: true //禁用滑块
//,theme: '#c00' //主题色
6 years ago
});
//sliderInst.setValue(30);
slider.render({
elem: '#slideTest2',
type: 'vertical'
});
6 years ago
});
</script>
</body>
</html>