Scrub Slider
Scrub Slider is a lightweight javascript plugin that lets you display transition images with style.
Why Scrub?
- Vanilla JS with no dependencies (not even jQuery)! -
- Just 29kb dist minified. -
- Support for using multiple sliders on a page. -
- Simple configuration options -
- Soon available on NPM and Yarn.. -
Getting Started
Download
- Download the Scrub Slider dist files from Github or from NPM or Yarn (coming soon..)
- Include the minified Scrub js and css files in the usual fashion..
Initiate
- Scrub needs to be passed a containing element and two image objects.
- Initiate a Scrub instance by calling Scrub() with a valid selector (of the parent element). This is best as an ID but a unique class is fine too.
- If you wish to configure your slider, pass Scrub() an object with config options (see below).
- The container should have a width. You have a choice for the two image children -> divs with background-images or imgs with src set are preferred, but you can also use a different tag and pass the src via config.