Snapshot của kenwheeler/slick: 28.5k★ · JavaScript. the last carousel you'll ever need
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Enables tabbing and arrow key navigation. Unless autoplay: true, sets browser focus to current slide (or first of current slide set, if multiple slidesToShow) after slide change. For full a11y compliance enable focusOnChange in addition to this.
adaptiveHeight
boolean
false
Adapts slider height to the current slide
appendArrows
string
$(element)
Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object)
appendDots
string
$(element)
Change where the navigation dots are attached (Selector, htmlString, Array, Element, jQuery object)
arrows
boolean
true
Enable Next/Prev arrows
asNavFor
string
$(element)
Enables syncing of multiple sliders
autoplay
boolean
false
Enables auto play of slides
autoplaySpeed
int
3000
Auto play change interval
centerMode
boolean
false
Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts.
centerPadding
string
'50px'
Side padding when in center mode. (px or %)
cssEase
string
'ease'
CSS3 easing
customPaging
function
n/a
Custom paging templates. See source for use example.
dots
boolean
false
Current slide indicator dots
dotsClass
string
'slick-dots'
Class for slide indicator dots container
draggable
boolean
true
Enables desktop dragging
easing
string
'linear'
animate() fallback easing
edgeFriction
integer
0.15
Resistance when swiping edges of non-infinite carousels
fade
boolean
false
Enables fade
focusOnSelect
boolean
false
Enable focus on selected element (click)
focusOnChange
boolean
false
Puts focus on slide after change
infinite
boolean
true
Infinite looping
initialSlide
integer
0
Slide to start on
lazyLoad
string
'ondemand'
Accepts 'ondemand' or 'progressive' for lazy load technique. 'ondemand' will load the image as soon as you slide to it, 'progressive' loads one image after the other when the page loads.
Allows you to select a node or customize the HTML for the "Previous" arrow.
respondTo
string
'window'
Width that responsive object responds to. Can be 'window', 'slider' or 'min' (the smaller of the two).
responsive
array
null
Array of objects containing breakpoints and settings objects (see example). Enables settings at given breakpoint. Set settings to "unslick" instead of an object to disable slick at a given breakpoint.
rows
int
1
Setting this to more than 1 initializes grid mode. Use slidesPerRow to set how many slides should be in each row.
rtl
boolean
false
Change the slider's direction to become right-to-left
slide
string
''
Slide element query
slidesPerRow
int
1
With grid mode initialized via the rows option, this sets how many slides are in each grid row.
slidesToScroll
int
1
# of slides to scroll at a time
slidesToShow
int
1
# of slides to show at a time
speed
int
300
Transition speed
swipe
boolean
true
Enables touch swipe
swipeToSlide
boolean
false
Swipe to slide irrespective of slidesToScroll
touchMove
boolean
true
Enables slide moving with touch
touchThreshold
int
5
To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider.
useCSS
boolean
true
Enable/Disable CSS Transitions
useTransform
boolean
true
Enable/Disable CSS Transforms
variableWidth
boolean
false
Disables automatic slide width calculation
vertical
boolean
false
Vertical slide direction
verticalSwiping
boolean
false
Changes swipe direction to vertical
waitForAnimate
boolean
true
Ignores requests to advance the slide while animating
zIndex
number
1000
Set the zIndex values for slides, useful for IE9 and lower
Responsive Option Example
The responsive option, and value, is quite unique and powerful.
You can use it like so:
In slick 1.4, callback methods were deprecated and replaced with events. Use them before the initialization of slick as shown below:
// On swipe event
$('.your-element').on('swipe', function(event, slick, direction){
console.log(direction);
// left
});
// On edge hit
$('.your-element').on('edge', function(event, slick, direction){
console.log('edge was hit')
});
// On before slide change
$('.your-element').on('beforeChange', function(event, slick, currentSlide, nextSlide){
console.log(nextSlide);
});
Event
Params
Description
afterChange
event, slick, currentSlide
After slide change callback
beforeChange
event, slick, currentSlide, nextSlide
Before slide change callback
breakpoint
event, slick, breakpoint
Fires after a breakpoint is hit
destroy
event, slick
When slider is destroyed, or unslicked.
edge
event, slick, direction
Fires when an edge is overscrolled in non-infinite mode.
init
event, slick
When Slick initializes for the first time callback. Note that this event should be defined before initializing the slider.
reInit
event, slick
Every time Slick (re-)initializes callback
setPosition
event, slick
Every time Slick recalculates position
swipe
event, slick, direction
Fires after swipe/drag
lazyLoaded
event, slick, image, imageSource
Fires after image loads lazily
lazyLoadError
event, slick, image, imageSource
Fires after image fails to load
Methods
Methods are called on slick instances through the slick method itself in version 1.4, see below:
// Add a slide
$('.your-element').slick('slickAdd',"<div></div>");
// Get the current slide
var currentSlide = $('.your-element').slick('slickCurrentSlide');
This new syntax allows you to call any internal slick method as well:
// Manually refresh positioning of slick
$('.your-element').slick('setPosition');
Method
Argument
Description
slick
options : object
Initializes Slick
unslick
Destroys Slick
slickNext
Triggers next slide
slickPrev
Triggers previous slide
slickPause
Pause Autoplay
slickPlay
Start Autoplay (will also set autoplay option to true)
slickGoTo
index : int, dontAnimate : bool
Goes to slide by index, skipping animation if second parameter is set to true
slickCurrentSlide
Returns the current slide index
slickAdd
element : html or DOM object, index: int, addBefore: bool
Add 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
slickRemove
index: int, removeBefore: bool
Remove 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 function
Filters slides using jQuery .filter syntax
slickUnfilter
Removes applied filter
slickGetOption
option : string(option name)
Gets an option value.
slickSetOption
change an option, refresh is always boolean and will update UI changes...
option, value, refresh
change a single option to given value; refresh is optional.
"responsive", [{ breakpoint: n, settings: {} }, ... ], refresh
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/kenwheeler/slick là nguồn chính thức.
kenwheeler/slick có bao nhiêu sao?
kenwheeler/slick có 28.5k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/kenwheeler/slick. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
kenwheeler/slick có phải mã nguồn mở không?
Có — kenwheeler/slick phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/kenwheeler/slick.
kenwheeler/slick còn đang phát triển không?
Commit gần nhất trên kenwheeler/slick là 2 tháng trước (theo timestamp GitHub). Repo có 5.7k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
kenwheeler/slick dùng license gì?
kenwheeler/slick phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
kenwheeler/slick là gì?
kenwheeler/slick (kenwheeler/slick) là dự án JavaScript trên GitHub. Theo mô tả gốc: the last carousel you'll ever need
kenwheeler/slick viết bằng ngôn ngữ gì?
kenwheeler/slick chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về slick?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về slick.