Touch, responsive, flickable carousels
A flickity fork that doesn't mess with your DOM.
See flickity.metafizzy.co for complete docs and demos.
- CSS:
- flickity.min.css minified, or
- flickity.css un-minified
- JavaScript:
- flickity.pkgd.min.js minified, or
- flickity.pkgd.js un-minified
Link directly to Flickity files on unpkg.
<linkrel="stylesheet" href="https://unpkg.com/flickity@2.1/dist/flickity.min.css"><!-- or --><linkrel="stylesheet" href="https://unpkg.com/flickity@2.1/dist/flickity.css"><scriptsrc="https://unpkg.com/flickity@2.1/dist/flickity.pkgd.min.js"></script><!-- or --><scriptsrc="https://unpkg.com/flickity@2.1/dist/flickity.pkgd.js"></script>Bower: bower install flickity --save
npm: npm install flickity --save
If you want to use Flickity to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Purchase a Flickity Commercial License at flickity.metafizzy.co
If you are creating an open source application under a license compatible with the GNU GPL license v3, you may use Flickity under the terms of the GPLv3.
Read more about Flickity's license.
Flickity works with a container element and a set of child cell elements
<divclass="carousel"><divclass="carousel-cell">...</div><divclass="carousel-cell">...</div><divclass="carousel-cell">...</div>
...
</div>varflky=newFlickity('.gallery',{// options, defaults listedaccessibility: true,// enable keyboard navigation, pressing left & right keysadaptiveHeight: false,// set carousel height to the selected slideautoPlay: false,// advances to the next cell// if true, default is 3 seconds// or set time between advances in milliseconds// i.e. `autoPlay: 1000` will advance every 1 secondcellAlign: 'center',// alignment of cells, 'center', 'left', or 'right'// or a decimal 0-1, 0 is beginning (left) of container, 1 is end (right)cellSelector: undefined,// specify selector for cell elementscontain: false,// will contain cells to container// so no excess scroll at beginning or end// has no effect if wrapAround is enableddraggable: true,// enables dragging & flickingdragThreshold: 3,// number of pixels a user must scroll horizontally to start dragging// increase to allow more room for vertical scroll for touch devicesfreeScroll: false,// enables content to be freely scrolled and flicked// without aligning cellsfriction: 0.2,// smaller number = easier to flick farthergroupCells: false,// group cells together in slidesinitialIndex: 0,// zero-based index of the initial selected celllazyLoad: true,// enable lazy-loading images// set img data-flickity-lazyload="src.jpg"// set to number to load images adjacent cellspercentPosition: true,// sets positioning in percent values, rather than pixels// Enable if items have percent widths// Disable if items have pixel widths, like imagesprevNextButtons: true,// creates and enables buttons to click to previous & next cellspageDots: true,// create and enable page dotsresize: true,// listens to window resize events to adjust size & positionsrightToLeft: false,// enables right-to-left layoutsetGallerySize: true,// sets the height of gallery// disable if gallery already has height set with CSSwatchCSS: false,// watches the content of :after of the element// activates if #element:after { content: 'flickity' }wrapAround: false// at end of cells, wraps-around to first for infinite scrolling});By Metafizzy