Giter VIP home page Giter VIP logo

ip-range's Introduction

IP Slider

Built With Stencil Published on webcomponents.org

A simple wrapper around <input type="range" /> HTML5 Element.

The range input itself has browser support about like: Firefox 23+, Safari 4+, iOS 5+, Chrome 6+, Opera 11+, IE 10+, Android 4.2+. So pretty good. This custom component should largely match that.

Inspired by CSS-TRICKS.

ip slider example

Install

Script tag

  • Put a script tag <script src='https://unpkg.com/[email protected]/dist/ip-slider.js'></script> in the head of your index.html
  • Then you can use the <ip-slider></ip-slider> element anywhere in your template, JSX, html etc

Node Modules

  • Run npm install ip-slider --save
  • Put a script tag similar to this <script src='node_modules/ip-slider/dist/ip-slider.js'></script> in the head of your index.html
  • Then you can use the <ip-slider></ip-slider> element anywhere in your template, JSX, html etc

In a Stencil app

  • Run npm install ip-slider --save
  • Add an import to the npm packages import 'ip-slider';
  • Then you can use the <ip-slider></ip-slider> element anywhere in your template, JSX, html etc

Using

Include ip-slider element in you page:

<ip-slider value="0" min="0" max="0" step="1"></ip-slider>

Add disabled attribute in order to disable.

You can get the value listening oninput event:

<ip-slider value="10" oninput="yourFunction(event)"></ip-slider>

This event is a CustomEvent:

function yourFunction(event) {
  console.log(event.detail.value);
}

To get the real event from input, get srcEvent:

function yourFunction(event) {
  console.log(event.detail.srcEvent);
}

Another option to get data:

const ipSlider = document.querySelector('ip-slider');

console.log(ipSlider.value);
console.log(ipSlider.min);
console.log(ipSlider.max);
console.log(ipSlider.step);
console.log(ipSlider.disabled);

Styles

Use these variables in order to change color or other stuff!

--primary: #66c56b;
--secondary: #227a1f;
--drag-cursor: grab;
--draging-cursor: grabbing;
--track-height: 4px;
--track-radius: 2px;
--track-border-width: 1px;
--track-border-color: rgba(143, 143, 143, 0.26);
--thumb-height: 17px;
--thumb-width: 17px;
--thumb-radius: 50%;
--thumb-border-width: 2px;
--thumb-border-color: rgba(143, 143, 143, 0.26);
--transition-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);

ip-range's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.