Skip to content

JavaScript Slider

The jSuites slider offers a responsive and lightweight solution for embedding dynamic photo galleries in web applications. Its straightforward integration process and versatile options make it ideal for enriching web environments with visually captivating galleries.

npm install jsuites
MethodDescription
open();Open the slider
close();Close the slider
show(imgElement);Open the slider if it is closed, and show the image passed as argument
next();Go to the next image
prev();Go to the previous image
reset();Remove all images
MethodDescription
onopenTrigger a method when the component is opened.
oncloseTrigger a method when the component is closed.
PropertyDescription
height: stringThe picker height.
width: stringThe picker width.
grid: booleanThe picker layout option.

<html>
<script src="https://jsuites.net/v6/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v6/jsuites.css" type="text/css" />

<div id="slider">
    <img src="https://jsuites.net/templates/default/img/car.jpeg"/>
    <img src="https://jsuites.net/templates/default/img/car2.jpeg"/>
    <img src="https://jsuites.net/templates/default/img/car3.jpeg"/>
</div>

<br>

<button id="open-slider" type="button" class="jbutton dark">Open the slider</button>

<script>
const slider = jSuites.slider(document.getElementById('slider'), {
    grid: true
});

document.getElementById('open-slider').addEventListener('click', function() {
    slider.open();
});
</script>
</html>