Ads

Sunday 29 June 2014

jQuery Responsive Touch Carousel (Slick)

Download   Demo


Features


Fully responsive. Scales with its container.

Separate settings per breakpoint

Uses CSS3 when available. Fully functional when not.

Swipe enabled. Or disabled, if you prefer.

Desktop mouse dragging

Infinite looping.

Fully accessible with arrow key navigation

Add, remove, filter & unfilter slides

Autoplay, dots, arrows, callbacks, etc.


CDN


CDN hosted slick is a great way to get set up quick:


In your <head> add:


<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.slick/1.3.6/slick.css"/>

Then, before your closing <body> tag add:


<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.slick/1.3.6/slick.min.js"/></script>

Options










































































































































OptionTypeDefaultDescription
accessibilitybooleantrueEnables tabbing and arrow key navigation
autoplaybooleanfalseEnables auto play of slides
autoplaySpeedint3000Auto play change interval
centerModebooleanfalseEnables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts.
centerPaddingstring’50px’Side padding when in center mode. (px or %)
cssEasestring‘ease’CSS3 easing
customPagingfunctionn/aCustom paging templates. See source for use example.
dotsbooleanfalseCurrent slide indicator dots
draggablebooleantrueEnables desktop dragging
easingstring‘linear’animate() fallback easing
fadebooleanfalseEnables fade
arrowsbooleantrueEnable Next/Prev arrows
appendArrowsstring$(element)Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object)
prevArrowstring (htmljQuery selector)object (DOM node
nextArrowstring (htmljQuery selector)object (DOM node
infinitebooleantrueInfinite looping
lazyLoadstring‘ondemand’Accepts ‘ondemand’ or ‘progressive’ for lazy load technique
onBeforeChange(this, index)methodnullBefore slide change callback
onAfterChange(this, index)methodnullAfter slide change callback
onInit(this)methodnullWhen Slick initializes for the first time callback
onReInit(this)methodnullEvery time Slick (re-)initializes callback
pauseOnHoverbooleantruePauses autoplay on hover
pauseOnDotsHoverbooleanfalsePauses autoplay when a dot is hovered
responsiveobjectnullBreakpoint triggered settings
slidestring‘div’Slide element query
slidesToShowint1# of slides to show at a time
slidesToScrollint1# of slides to scroll at a time
speedint300Transition speed
swipebooleantrueEnables touch swipe
touchMovebooleantrueEnables slide moving with touch
touchThresholdint5To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider.
useCSSbooleantrueEnable/Disable CSS Transitions
verticalbooleanfalseVertical slide direction

Methods








































MethodArgumentDescription
slick()options : objectInitializes Slick
unslick()
Destroys Slick
slickNext()
Triggers next slide
slickPrev()
Triggers previous slide
slickPause()
Pause Autoplay
slickPlay()
Start Autoplay
slickGoTo()index : intGoes to slide by index
slickCurrentSlide()
Returns the current slide index
slickAdd()element : html or DOM object, index: int, addBefore: boolAdd a slide. If an index is provided, will add at that index, or before if addBefore is set. If no index is provided, add to the end or to the beginning if addBefore is set. Accepts HTML String
slideRemove()index: int, removeBefore: boolRemove slide by index. If removeBefore is set true, remove slide preceding index, or the first slide if no index is specified. If removeBefore is set to false, remove the slide following index, or the last slide if no index is set.
slickFilter()filter : selector or functionFilters slides using jQuery .filter syntax
slickUnfilter()
Removes applied filter
slickGetOption(option)option : string(option name)Gets an option value.
slickSetOption(option,value,refresh)option : string(option name), value : depends on option, refresh : booleanSets an option live. Set refresh to true if it is an option that changes the display

Example


Initialize with:



$(element).slick(
dots: true,
speed: 500
);


Destroy with:



$(element).unslick();


Sass Variables














































VariableTypeDefaultDescription
$slick-font-pathstring“./fonts/”Directory path for the slick icon font
$slick-font-familystring“slick”Font-family for slick icon font
$slick-loader-pathstring“./”Directory path for the loader image
$slick-arrow-colorcolorwhiteColor of the left/right arrow icons
$slick-dot-colorcolorblackColor of the navigation dots
$slick-dot-color-activecolor$slick-dot-colorColor of the active navigation dot
$slick-prev-characterstring‘\2190′Unicode character code for the previous arrow icon
$slick-next-characterstring‘\2192′Unicode character code for the next arrow icon
$slick-dot-characterstring‘\2022′Unicode character code for the navigation dot icon
$slick-dot-sizepixels6pxSize of the navigation dots

Dependencies


jQuery 1.7



jQuery Responsive Touch Carousel (Slick)

No comments:

Post a Comment