| title | Options |
|---|---|
| layout | docs.html |
| slug | options |
| priority | 6 |
| algolia | true |
[[lead]]Glide can be adjusted with various options. Pass an object as an argument while initializing a new instance[[/lead]]
new Glide('.glide', {
type: 'carousel',
startAt: 0,
perView: 3
})type- Type of the movementstartAt- Start at specific slide numberperView- A number of visible slidesfocusAt- Focus currently active slide at a specified positiongap- A size of the space between slidesautoplay- Change slides after a specified intervalhoverpause- Stop autoplay on mouseoverkeyboard- Change slides with keyboard arrowsbound- Stop runningperViewnumber of slides from the endswipeThreshold- Minimal swipe distance needed to change the slidedragThreshold- Minimal mousedrag distance needed to change the slideperTouch- A maximum number of slides moved per single swipe or dragtouchRatio- Alternate moving distance ratio of swiping and draggingtouchAngle- Angle required to activate slides movinganimationDuration- Duration of the animationrewind- Allow looping theslidertyperewindDuration- Duration of the rewinding animationanimationTimingFunc- Easing function for the animationdirection- Moving direction modepeek- The value of the future viewports which have to be visible in the current viewbreakpoints- Collection of options applied at specified media breakpointsclasses- Collection of used HTML classesthrottle- Throttle costly events
Type of the movement. Available types:
slider- rewinds slider to the start/end when it reaches first or last slide,carousel- changes slides without starting over when it reaches first or last slide.
default: 'slider' type: String
[[example dir=options/type]]
Start at specific slide number defined with zero-based index.
default: 0 type: Number
[[example dir=options/start-at]]
A number of slides visible on the single viewport.
default: 1 type: Number
[[example dir=options/per-view]]
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,1,2,3...- current slide will be focused on the specified zero-based index.
default: 0 type: Number|String
[[example dir=options/focus-at]]
A size of the gap added between slides.
default: 10 type: Number
[[example dir=options/gap]]
Change slides after a specified interval. Use false for turning off autoplay.
default: false type: Number|Boolean
[[example dir=options/autoplay]]
Stop autoplay on mouseover event.
default: true type: Boolean
[[example dir=options/hoverpause]]
Allow for changing slides with left and right keyboard arrows.
default: true type: Boolean
[[example dir=options/keyboard]]
Works only with
slidertype and a non-centeredfocusAtsetting.
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.
default: false type: Boolean
[[example dir=options/bound]]
Minimal swipe distance needed to change the slide. Use false for turning off a swiping.
default: 80 type: Number|Boolean
[[example dir=options/swipe-threshold]]
Minimal mouse drag distance needed to change the slide. Use false for turning off a dragging.
default: 120 type: Number|Boolean
[[example dir=options/drag-threshold]]
A maximum number of slides to which movement will be made on swiping or dragging. Use false for unlimited.
default: false type: Number|Boolean
[[example dir=options/per-touch]]
Alternate moving distance ratio of the slides on a swiping and dragging.
default: 0.5 type: Number
[[example dir=options/touch-ratio]]
Angle required to activate slides moving on swiping or dragging.
default: 45 type: Number
[[example dir=options/touch-angle]]
Duration of the animation in milliseconds.
default: 400 type: Number
[[example dir=options/animation-duration]]
Works only with
slidertype.
Allows looping the slider type. Slider will rewind to the first/last slide when it's at the start/end.
default: true type: Boolean
[[example dir=options/rewind]]
Duration of the rewinding animation of the slider type in milliseconds.
default: 800 type: Number
[[example dir=options/rewind-duration]]
Easing function for the animation.
default: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)' type: String
[[example dir=options/animation-timing-func]]
Moving direction mode. Available inputs:
- 'ltr' - left to right movement,
- 'rtl' - right to left movement.
default: 'ltr' type: String
[[example dir=options/direction]]
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 setup 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.
default: 0 type: Number|Object
[[example dir=options/peek]]
Collection of options applied at specified media breakpoints. For example, display two slides per view under 800px:
{
800: {
perView: 2
}
}
default: {} type: Object
[[example dir=options/breakpoints]]
Collection of internally used HTML classes. Default values:
type: Object
{
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'
}
}
Throttle costly events at most once per every wait milliseconds.
default: 25 type: Number