@glidejs/glide
Version:
Glide.js is a dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
229 lines (204 loc) • 4.91 kB
JavaScript
export default {
/**
* Type of the movement.
*
* Available types:
* `slider` - Rewinds slider to the start/end when it reaches the first or last slide.
* `carousel` - Changes slides without starting over when it reaches the first or last slide.
*
* @type {String}
*/
type: 'slider',
/**
* Start at specific slide number defined with zero-based index.
*
* @type {Number}
*/
startAt: 0,
/**
* A number of slides visible on the single viewport.
*
* @type {Number}
*/
perView: 1,
/**
* Focus currently active slide at a specified position in the track.
*
* Available inputs:
* `center` - Current slide will be always focused at the center of a track.
* `0,1,2,3...` - Current slide will be focused on the specified zero-based index.
*
* @type {String|Number}
*/
focusAt: 0,
/**
* A size of the gap added between slides.
*
* @type {Number}
*/
gap: 10,
/**
* Change slides after a specified interval. Use `false` for turning off autoplay.
*
* @type {Number|Boolean}
*/
autoplay: false,
/**
* Stop autoplay on mouseover event.
*
* @type {Boolean}
*/
hoverpause: true,
/**
* Allow for changing slides with left and right keyboard arrows.
*
* @type {Boolean}
*/
keyboard: true,
/**
* Stop running `perView` number of slides from the end. Use this
* option if you don't want to have an empty space after
* a slider. Works only with `slider` type and a
* non-centered `focusAt` setting.
*
* @type {Boolean}
*/
bound: false,
/**
* Minimal swipe distance needed to change the slide. Use `false` for turning off a swiping.
*
* @type {Number|Boolean}
*/
swipeThreshold: 80,
/**
* Minimal mouse drag distance needed to change the slide. Use `false` for turning off a dragging.
*
* @type {Number|Boolean}
*/
dragThreshold: 120,
/**
* A number of slides moved on single swipe.
*
* Available types:
* `` - Moves slider by one slide per swipe
* `|` - Moves slider between views per swipe (number of slides defined in `perView` options)
*
* @type {String}
*/
perSwipe: '',
/**
* Moving distance ratio of the slides on a swiping and dragging.
*
* @type {Number}
*/
touchRatio: 0.5,
/**
* Angle required to activate slides moving on swiping or dragging.
*
* @type {Number}
*/
touchAngle: 45,
/**
* Duration of the animation in milliseconds.
*
* @type {Number}
*/
animationDuration: 400,
/**
* Allows looping the `slider` type. Slider will rewind to the first/last slide when it's at the start/end.
*
* @type {Boolean}
*/
rewind: true,
/**
* Duration of the rewinding animation of the `slider` type in milliseconds.
*
* @type {Number}
*/
rewindDuration: 800,
/**
* Easing function for the animation.
*
* @type {String}
*/
animationTimingFunc: 'cubic-bezier(.165, .840, .440, 1)',
/**
* Wait for the animation to finish until the next user input can be processed
*
* @type {boolean}
*/
waitForTransition: true,
/**
* Throttle costly events at most once per every wait milliseconds.
*
* @type {Number}
*/
throttle: 10,
/**
* Moving direction mode.
*
* Available inputs:
* - 'ltr' - left to right movement,
* - 'rtl' - right to left movement.
*
* @type {String}
*/
direction: 'ltr',
/**
* The distance value of the next and previous viewports which
* have to peek in the current view. Accepts number and
* pixels as a string. Left and right peeking can be
* set up separately with a directions object.
*
* For example:
* `100` - Peek 100px on the both sides.
* { before: 100, after: 50 }` - Peek 100px on the left side and 50px on the right side.
*
* @type {Number|String|Object}
*/
peek: 0,
/**
* Defines how many clones of current viewport will be generated.
*
* @type {Number}
*/
cloningRatio: 1,
/**
* Collection of options applied at specified media breakpoints.
* For example: display two slides per view under 800px.
* `{
* '800px': {
* perView: 2
* }
* }`
*/
breakpoints: {},
/**
* Collection of internally used HTML classes.
*
* @todo Refactor `slider` and `carousel` properties to single `type: { slider: '', carousel: '' }` object
* @type {Object}
*/
classes: {
swipeable: 'glide--swipeable',
dragging: 'glide--dragging',
direction: {
ltr: 'glide--ltr',
rtl: 'glide--rtl'
},
type: {
slider: 'glide--slider',
carousel: 'glide--carousel'
},
slide: {
clone: 'glide__slide--clone',
active: 'glide__slide--active'
},
arrow: {
disabled: 'glide__arrow--disabled'
},
nav: {
active: 'glide__bullet--active'
}
}
}