artatol / sliderpips
一个为jQuery UI滑动控件添加“小标记”的插件
此软件包的官方仓库似乎已丢失,因此该软件包已被冻结。
This package is not auto-updated.
Last update: 2024-09-18 07:31:02 UTC
README
#jQuery UI 滑动器标记 ####插件,用于向JQUI滑动器添加“标记”或“浮动”。
此插件扩展了jQuery UI滑动器控件。
使用它创建一个如以下所示的样式精美的滑动器
在此处查看文档、演示和示例
===
警告
与jqueryui 1.11.2存在不兼容性,如果在使用不能被最大值整除的步长值时,则标记和标签将放置不均匀。目前对此无能为力,因此此插件的下一个更新将破坏向后兼容性。对此表示歉意。
===
###安装 如果您使用Bower,您可以从命令行快速安装此插件! :)
bower install jquery-ui-slider-pips --save
否则,您可以下载/dist/
文件夹中的文件。
###要求
- jQuery (1.9+)
- jQuery UI (1.10+)
###使用
在jQuery & jQuery-ui之后包含插件javascript文件。
包含CSS文件;请随意编辑。
以下方法可链接使用,我已将它们分开显示以增强清晰度
####默认使用方法
<!-- this widget needs an empty div tag. Note the class used on this div and on the jquery selectors below need to be the same... --> <div class="element"></div>
// if you just want the defaults, copy & paste this code. $('.element').slider().slider('pips').slider('float');
####带有选项的高级使用方法
// First of all attach a slider to an element. If you want to customize the range of values, you do it in the initialization. $('.element').slider({min: 20, max: 65}); // Then you can give it pips and labels! $('.element').slider('pips', { first: 'label', last: 'label', rest: 'pip', labels: ['label1', 'label2', ...], prefix: "", suffix: "" }); // And finally can add floaty numbers (if desired) $('.element').slider('float', { handle: true, pips: true, labels: ['label1', 'label2', ...], prefix: "", suffix: "" });
####标记选项
first: "pip"
或 "label"
或 false
last: "pip"
或 "label"
或 false
rest: "pip"
或 "label"
或 false
labels: []
或 {first: "", last: "", rest: [] }
或 false
prefix: "string"
suffix: "string"
formatLabel: function(val){ return this.prefix + val + this.suffix }
####浮动选项
handle: true
或 false
pips: true
或 false
labels: []
或 {first: "", last: "", rest: [] }
或 false
prefix: "string"
suffix: "string"
formatLabel: function(val){ return this.prefix + val + this.suffix }
###样式定制
所有定制应针对CSS文件或您自己的CSS进行。
我提供的基样式在演示中表现不错,
但可能需要根据您的需求和UI主题进行调整。
有关灵感和样式设计的帮助,请访问文档中的样式部分。
###兼容性
现代浏览器,IE7+
(为了真正支持IE7,您可能需要做一些CSS更改。)
###许可证
开源MIT。
https://open-source.org.cn/licenses/MIT