项目作者: wasper1

项目描述 :
Rotating slider
高级语言: JavaScript
项目地址: git://github.com/wasper1/rotating-slider.git
创建时间: 2020-09-08T13:01:32Z
项目社区:https://github.com/wasper1/rotating-slider

开源协议:MIT License

下载


rotating-slider

Rotating slider for selecting numerical values.
Allows mobile friendly precise selection for value from selected range with desired step.
Component is especially useful for hybrid application using frameworks like Ionic, Cordova or PhoneGap.

Demo

Live demo is available here

Production usage example

Install

npm install rotating-slider

Usage

HTML

  1. <html>
  2. <head>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <link rel="stylesheet" href="https://wasper1.github.io/rotating-slider/src/rotating-slider.css">
  5. </head>
  6. <body>
  7. <div>
  8. Integers
  9. <h1 id="rotating-slider1"></h1>
  10. </div>
  11. <div>
  12. Decimal numbers
  13. <h1 style="width: 50%; margin: auto;" id="rotating-slider2"></h1>
  14. </div>
  15. </body>
  16. </html>

js

  1. import RotatingSlider from 'rotating-slider';
  2. RotatingSlider("#rotating-slider1", {min: 1, max: 100, step: 1}, 10)
  3. .setChangeCallback(val => {console.log(val);});
  4. RotatingSlider("#rotating-slider1", {min: 1, max: 5, step: 0.5}, 3.5)
  5. .setChangeCallback(val => {console.log(val);});

License

This project is available under the MIT license.