jQuery圆形范围滑块插件 圆形滑块

  • 源码大小:213.55KB
  • 所需积分:1积分
  • 源码编号:19JP-3733
  • 浏览次数:1048次
  • 最后更新:2023年07月16日
  • 所属栏目:滑块
我要下载
加入收藏
本站默认解压密码:19jp.com 或 19jp_com

简介

roundSlider是一个jQuery插件,用于将DIV元素转换为圆形范围滑块,它可以帮助您通过鼠标拖动来滑动值的范围

内置形状:

  • 完整的圆圈
  • 左上角四分之一
  • 右上角四分之一
  • 右下角四分之一
  • 四分之一左下
  • 半顶
  • 半底部
  • 左半
  • 右半
  • 馅饼
  • 自定义一半
  • 自定义季度

参见:

  • 带有jQuery和jQuery UI的最小循环范围滑块
  • 用于360度圆形范围选择器的jQuery插件
  • 用于360度圆形滑块的jQuery插件
  • 用于多用途圆形滑块控件的jQuery插件
  • 用于圆形旋转木马滑块的Cool jQuery插件-微小圆形滑块

基本用法:

1.在安装了jQuery库的网页中包含jQuery roundSlider插件的样式表和JS文件。

  1. <script src="jquery.min.js"></script>
  2. <link href="src/roundSlider.css" rel="stylesheet" />
  3. <script src="src/roundSlider.js"></script>

2.为圆形范围滑块创建一个DIV元素。

  1. <div id="demo"></div>

3.调用DIV元素上的插件,生成一个完整圆形的默认范围滑块。

  1. $("#demo").roundSlider({
  2. // options here
  3. });

4.该插件提供了大量选项,可以帮助您自定义范围滑块。以下是具有默认值的完整选项列表。

  1. // min / max value
  2. min: 0,
  3. max: 100,
  4.  
  5. // custom step
  6. step: 1,
  7.  
  8. // initial value
  9. value: null,
  10.  
  11. // customize the slider
  12. radius: 85,
  13. width: 18,
  14. // the below props are relative to "width" when you provide the value starts with "+" or "-"
  15. // otherwise if you provide any number then it will take the exact value
  16. pathWidth: "+0",
  17. handleSize: "+0",
  18.  
  19. startAngle: 0,
  20. endAngle: "+360",
  21.  
  22. // enable animation
  23. animation: true,
  24.  
  25. // enable tooltip
  26. showTooltip: true,
  27. editableTooltip: true,
  28.  
  29. // read-only mode
  30. readOnly: false,
  31.  
  32. // disabled mode
  33. disabled: false,
  34.  
  35. // allow for keyboard interaction
  36. keyboardAction: true,
  37.  
  38. // enable mousel scroll action
  39. mouseScrollAction: false,
  40.  
  41. // square, or round
  42. lineCap: "butt",
  43.  
  44. // default, min-range or range
  45. sliderType: "default",
  46.  
  47. // full, quarter-top-left, quarter-top-right, quarter-bottom-right,
  48. // quarter-bottom-left, half-top, half-bottom, half-left, half-right,
  49. // pie, custom-half, custom-quarter
  50. circleShape: "full",
  51.  
  52. // round, dot, or square
  53. handleShape: "round",
  54.  
  55. // the 'startValue' property decides at which point the slider should start.
  56. // otherwise, by default the slider starts with min value. this is mainly used
  57. // for min-range slider, where you can customize the min-range start position.
  58. startValue: null,
  59.  
  60. allowInvertedRange: false,
  61. handleRotation: false,
  62. snapToStep: true,
  63.  
  64. // SVG related properties
  65. svgMode: true,
  66. borderWidth: 1,
  67. borderVisibility: "both",
  68. borderColor: "#AAA",
  69. pathColor: "#FFF",
  70. rangeColor: "#54BBE0",
  71. handleColor: null,
  72. tooltipColor: null,
  73.  
  74. // events
  75. beforeCreate: null,
  76. create: null,
  77. start: null,
  78. beforeValueChange: null,
  79. drag: null,
  80. change: null,
  81. update: null,
  82. valueChange: null,
  83. stop: null,
  84. tooltipFormat: null

5.API方法。

  • getValue:获取当前值。
  • setValue:设置为新值
  • disable:禁用插件
  • enable:启用插件
  • destroy:销毁插件
  • refreshTooltip:刷新工具提示

更新日志:

2022-01-24

  • 更新roundslider.js

2.0.0版alpha(2021-09-06)

  • 添加了“pathWidth”和“rangeWidth”属性

v1.6.1 (2020-07-04)

  • 与更改事件相关的Bug修复
  • 现在borderColor、pathColor和tooltipColor属性支持“inherit”

v1.6.0 (2020-06-08)

  • 使用CommonJS模块语法更新了源代码
  • 为以下所有类添加了rs-前缀,以避免与应用程序级样式重叠:full、half、top、bottom、right、left、quarter、edit、hover

v1.5.2 (2020-05-13)

  • 修复了与beforeValueChange事件相关的错误
  • 代码清理

v1.5.1 (2020-04-23)

  • 添加了新的属性和方法:“tooltipColor”和“refreshTooltip()”

v1.5.0 (2020-04-18)

  • 添加了新事件

v1.4.1 (2020-03-25)

  • 添加了startValue属性
  • 错误修正

v1.4.0 (2020-01-29)

  • 添加了对SVG模式的支持。它可以通过属性svgMode:true启用,以避免对现有用户进行破坏性更改。
  • 为SVG模式添加了更多选项

2019-01-17

  • 第3.3版

2018-04-22

  • v1.3.2版本

2016-02-29

  • 第1.3版

2016-02-09

  • _handleDragDistance基于代码的更改已更新。

2016-01-31

  • 已更新所有事件的参数列表。

2016-01-24

  • v1.2:防止点击未使用的角度

2016-01-04

  • 将属性名称从“roundedCorner”修改为“lineCap”,还添加了一些源代码更正。

2015-11-28

  • 变更事件相关问题已解决。

2015-11-26

  • JS更新

2015-10-26

  • 版本1.1

2015-10-21

  • 圆角相关问题已解决。

2015-10-20

  • 添加了roundedCorner属性以实现圆角边缘。

2015-10-12

  • 修复了setValue函数中的一个问题

2015-08-02

  • 更新了来源

预览截图