You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 5, 2022. It is now read-only.
This project is now archived. We don't use carousels any more, andyoushouldn'teither.
Svelte Carousel
Svelte Carousel / Slider
This is a ground-up rewrite of the original Svelte Carousel/Slider using Svelte v3, and Siema, the goal being a fully working carousel with a tiny size.
Usage
This library is pure javascript, so can be used with any framework you like.
You can set the controls to be anything you like, though the default height and width are set to 40px. Just use the slots available to insert your own content.
At the end of the carousel, loop through to the first slide again, seamlessly
perPage
integer
3
Number of slides on a single page. Note that this needs to be less than or equal to the number of slides in your carousel
autoplay
integer
0
Auto-change slide at an interval (in milliseconds). 0 means don't autoplay.
duration
number
200
Slide transition duration in milliseconds.
easing
string
'ease-out'
It is like a CSS transition-timing-function — describes acceleration curve.
startIndex
number
0
Index (zero-based) of the starting slide.
draggable
boolean
true
Use dragging and touch swiping.
multipleDrag
boolean
true
Allow dragging to move multiple slides.
dots
boolean
true
Toggles visibility of slider dots.
controls
boolean
true
Toggles visibility of slider controls. dots.
threshold
number
20
Touch and mouse dragging threshold (in px).
rtl
boolean
false
Enables layout for languages written from right to left (like Hebrew or Arabic).
perPage can also be set to a responsive object, to change the number of slides based on screen width:
<CarouselperPage={{800: 3,500: 2}}>
// will show 1 slide below 500px width, 2 at 500, 3 at 800.
Events
The Carousel components emits the following events:
Name
Data
Description
change
{ currentSlide, slideCount }
currentSlide: The current slide index. Can be a positive or negative integer. slideCount: The number of slides.
Actions
You can call left, right, go(slideNumber), pause and resume functions on the slider. For example, for pausing the autoslide while the mouse is hover the carousel