“Image Slider” Component
Our image slider component is a simple slider implemented with help from Siema Library.
Example
Usage
Template
@include('components.imageSlider', ['images' => [
['url' => '/images/01.jpg', 'description' => 'Image #1 description'],
['url' => '/images/02.jpg', 'description' => 'Image #2 description'],
]])
JS
import {initImageSliders} from 'modules/imageSlider.js';
const settings = {slideDuration: 300};
initImageSliders(settings);
Props
-
images (required)array<int, array{url: string, description: string}>
A dictionary of elements with URL and description.
-
aspectRatiostring
A string value representing an aspect-ratio CSS rule.
-
hideNavOnSmallbool
Changes style on small screen, like hiding nav control.
Settings Object
-
autoplayboolean
Should carousel rotate automatically.
Default Value:
true
-
durationnumber
Slide animation duration.
Default Value:
400
-
slideDurationnumber
Number of ms after which next slide is shown.
Default Value:
500
-
loopboolean
Should the carousel loop.
Default Value:
true
-
easingstring
Easing animation for slider.
Default Value:
ease-out
-
perPagenumber
The number of slides to be shown.
Default Value:
1
-
startIndexnumber
Index of first slide.
Default Value:
0
-
draggableboolean
Decides whether slides are draggable.
Default Value:
true
-
multipleDragboolean
Allow dragging to move multiple slides.
Default Value:
true
-
thresholdnumber
Touch and mouse dragging threshold (in px).
Default Value:
20