JavaScript Stacking and unstacking slider.
dist/
├── stackslider.css
├── stackslider.js
npm i stack-slider
In browser:
<link href="/path/to/stackslider.css" rel="stylesheet">
<script src="/path/to/stackslider.js"></script>
var container = document.getElementById('op-container');
new OPSlider(container, 1000);
-
element
- Type:
HTMLElement
- The target id of the slider.
- Type:
-
options
- Type:
Number
- Transition time in milliseconds
- Type:
<section id="op-container">
<div class="op-wrapper">
<section id="slide-1" class="slide-item">
{{content}}
</section>
<section id="slide-2" class="slide-item">
{{content}}
</section>
</div>
</section>
/* Ensure the slider fits perfectly */
html,body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
- There should atleast be 2 items in the slider.
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Opera (latest)
- Edge (latest)
- Internet Explorer 9+