minsky-carousel v1.2.2
Carousel
A content carousel based on Swiper
Everybody loves carousels. This class is pretty much plug and play for any type of content. Enjoy our PeireMeulen!
Class type: Component
Dependencies
- Component 1.0.0
Getting started
First wait until Swiper is loaded, then pass the parent of the content. For a full list of possible settings: https://idangero.us/swiper/api/#parameters
Javascript
import Carousel from 'minsky-carousel';
const carousel = new Carousel({
el: [DOM ELEMENT],
settings: {
property: value
}
});
SCSS
@import 'minsky-carousel/css/carousel.scss';
Constructor Parameters
args
Type: Object
Default: {}
Config options that will be used when instance is created
objectName
Type: String
Default: 'Carousel'
Object name that will be used as recognisable identifier and as prefix in logs
Interface
Methods
setSettings
Parameters: settings:object, autoReInnit:Boolean = true
Return: self
Applies given settings to swiper by merging it with the params property. It’ll automatically re-innit the swiper instance when not specified otherwise
next
Parameters: [ none ]
Return: self
Slides to next slide
previous
Parameters: [ none ]
Return: self
Slides to previous slide
refresh
Parameters: [ none ]
Return: self
Refreshes the swiper instance
Destroy
Parameters: [ none ]
Return: undefined
Removes every trace of Swiper and puts everything back to normal
To Do
- Move mergeObjects and mergeArrays methods outside of the class definition
- See if general class can be used over extentions so has-control-modifiers don’t need to be defined every time the object name changes.