Get simple slider for your application
4.6.0
Install the package
npm install vm-slider-js
yarn add vm-slider-js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Slider App</title>
<style>
* {
box-sizing: border-box;
}
</style>
</head>
<body>
<div id="slider">
<img src="#" alt="Slider #1" />
<img src="#" alt="Slider #2" />
<img src="#" alt="Slider #3" />
<img src="#" alt="Slider #4" />
</div>
<script src="./dist/vm-slider-js.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function (event) {
new SliderJS('slider', options)
})
</script>
</body>
</html>
import { SliderJS } from 'vm-slider-js'
new SliderJS('slider', options)
You can pass the 2nd argument as an object with options
SliderJS supports 5 options which are all optional:
- width - size of images in (px) (Default 940)
- height - height of images (px) (Default is 270)
- iconSize - height of icons (px) (Default is 60)
- timeout - auto sliding timer (ms) (Default is 3000)
- hideControls - true / false (Default is false)