Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@danchitnis/simple-slider

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@danchitnis/simple-slider

A simple cross-platform slider

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

simple-slider

A simple range slider based on vanilla HTML, CSS and JS with no dependencies. Features include:

  • Cross-browser compatibility using vanilla Javascript and CSS
  • Simple constructor and developer friendly
  • Single file library with no dependency, written in Typescript and compatible with ES6
  • Can be bundled with modern tools such as RollupJS
  • Touch enabled for touchscreen devices
  • Responsive to real-time layout change

Example

Initialization

const slider = new SimpleSlider("slider", 0, 100, 0);

handle the update event

slider.addEventListener("update", e => {
  pValue.innerHTML = slider.value.toString() + "%";
});

Redraw the slider upon window resize

window.addEventListener("resize", () => {
  slider.resize();
});

JSfiddle Example

CodePen Example

Edit Simple Slider

Webkit (i.e. Safari & iPhone)

Add the following polyfill before your script to have support for Webkit. This also includes Chrome on iPhone since it is based on Webkit.

<script src="https://unpkg.com/@ungap/event-target"></script>

This package will automatically detect if Event-Target is present in the browser.

API documentation

See here 🧾

Contributions

inspired by noUiSlider

Keywords

FAQs

Package last updated on 15 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc