Слайдер Carousel FredSel. Документация
Подключение более чем стандартное:
- Скачиваете скрипт с гитхаба.
- Подключаете на страницу после jquery.
- Инициализируете кодом
$('#carousel').carouFredSel();
Я не стану рассказывать об особенностях работы, потому что есть отличная библиотека с 72-мя примерами слайдеров. Смотрите, ищите, копируйте, совмещайте.
Этот пост — необходимость сохранить обширную документацию по функциям карусели. Сайт, содержащий её ранее, умер, но вебархив помог мне вытащить копию.
Настройка Carousel FredSel
Note: It is possible to create a non-circular, infinite carousel, but it is not possible to create a circular, non-infinite carousel.
If
true
, the items will be resized to fill the carousel.Possible values:
"right"
, "left"
, "up"
or "down"
.If
null
, the width will be calculated (and set to "variable"
if necessary, depending on the item-widths)."variable"
to automatically resize the carousel when scrolling items with variable widths."auto"
to measure the widest item.Note: Only applies on horizontal carousels.
For example:
"100%"
.If
null
, the height will be calculated (and set to "variable"
if necessary, depending on the item-heights)."variable"
to automatically resize the carousel when scrolling items with variable heights."auto"
to measure the highest item.Note: Only applies on vertical carousels.
For example:
"100%"
.Possible values:
"center"
, "left"
, "right"
or false
.For example:
[10, 20, 30, 40]
(top, right, bottom, left)or
[0, 50]
(top/bottom, left/right).[string selector, boolean inheritOptions, boolean sameDirection, number deviation] For example:
["#foo2", true, true, 0]
data = {
'width', // The new width for the carousel.
'height', // The new height for the carousel.
'items' // A jQuery-object of the visible items.
};
visible
, minimum
, start
, width
, height
and filter
.items.visible
."variable"
for items.width
, items.height
and items.visible
.If
null
, the number will be calculated (and set to "variable"
if necessary)."variable"
to measure the number of visible items(based on the available size).
min
and max
.- base:
"odd"
,"even"
or""
(an empty string, default). - adjustment:
"+"
or"-"
. - amount:any number (1 by default)
"odd+2"
will measure the number of items needed to fill the available size, decrease it to an odd number and increase it by two.
This function receives 1 parameter:
- visibleItems: the number of items that would fit the available size.
If
null
, the number for items.visible
is inherited and increased by 1.Hint: This can also be a negative number.
"random"
to let the plugin pick a randon item to start the carousel.For example:
"#foo li:first"
.For example:
$("#foo li:first")
.true
, the plugin will search for an item-anchor to start the carousel using the url-hashtag.For example: http://domain.com#startitem
If
null
, the width will be measured (and set to "variable"
if necessary)."variable"
to create a carousel that supports variable item-widths.Note: Only applies on responsive, vertical carousels.
For example:
"50%"
.If
null
, the height will be measured (and set to "variable"
if necessary)."variable"
to create a carousel that supports variable item-heights.Note: Only applies on responsive, horizontal carousels.
For example:
"50%"
.If
null
, all elements inside the carousel will be considered to be an item.If the carousel contains :hidden-elements, it is set to
":visible"
.Note: this option is not (yet) compatible with non-circular carousels.
items
, fx
, easing
, duration
, pauseOnHover
, queue
, event
, conditions
, onBefore
, onAfter
and onEnd
.scroll.items
or -if greater than 50- for scroll.duration
.scroll.easing
.If
null
, the number of visible items is used."page"
to scroll to the first item of the previous/next «page».- base:
"odd"
,"even"
or""
(an empty string, default). - adjustment:
"+"
or"-"
. - amount:any number (1 by default)
"odd+2"
will decrease the number of visible items to an odd number and increase it by two.Possible values:
"none"
, "scroll"
, "directscroll"
, "fade"
, "crossfade"
, "cover"
, "cover-fade"
, "uncover"
or "uncover-fade"
."linear"
and "swing"
, built in: "quadratic"
, "cubic"
and "elastic"
.If less than
10
, the number is interpreted as a speed (pixels/millisecond).This is probably desirable when scrolling items with variable sizes.
"resume"
to let the timeout resume instead of restart «onMouseOut»."immediate"
to immediately stop «onMouseOver» and resume «onMouseOut» a scrolling carousel."immediate-resume"
for both the options above."first"
to queue only the first scroll."last"
to queue only the last scroll (all previous queued scroll will be removed).If it doesn’t return
true
, the carousel will not scroll.This function receives one parameter:
direction // The direction of the transition.
This function receives a map of all data:
data = {
'width', // The new width for the carousel.
'height', // The new height for the carousel.
'items': {
'old', // A jQuery-object of the items that are visible
before scrolling.
'skipped', // A jQuery-object of the items between the old
and new items.
'visible' // A jQuery-object of the items that will be visible
after scrolling.
},
'scroll': {
'items', // The number of items scrolled.
'direction', // The direction of the transition.
'duration' // The duration of the transition.
}
};
This function receives the same parameter as the
onBefore
-callback function.This function receives one parameter:
direction // The direction of the transition.
play
, button
, timeoutDuration
, delay
, progress
, items
, fx
, easing
, duration
, pauseOnHover
, pauseOnEvent
, pauseOnResize
, queue
, event
, conditions
, onBefore
, onAfter
, onEnd
, onTimeoutStart
, onTimeoutEnd
and onTimeoutPause
.This object is the same as the scroll
object, except for play
, button
, timeoutDuration
, delay
, progress
, pauseOnEvent
, pauseOnResize
, onTimeoutStart
, onTimeoutEnd
and onTimeoutPause
. What is not specified in this object, will be inherited from the scroll
object.
auto.play
.auto.timeoutDuration
.If
auto.duration
is less then 10
-to use a speed (in pixels/milliseconds) instead of a duration-, the default value is 2500
.Hint: This can also be a negative number.
bar
, updater
and interval
.updater
-callback function.updater
-callback function..progressbarUpdater
This function receives one parameter:
percentage // A percentage of the time passed in the timeout
(from 0 to 100).
updater
-callback function.scroll.items
.scroll.fx
.scroll.easing
.scroll.duration
.scroll.pauseOnHover
.See the description for
scroll.pauseOnHover
.Note: Only applies on responsive carousels.
scroll.queue
.scroll.event
.scroll.conditions
.scroll.onBefore
.scroll.onAfter
.scroll.onEnd
.This function receives 2 parameters:
- percentage: The percentage the
auto.timeoutDuration
is at. - duration: The remaining time left in milliseconds.
Functionality is the same as for the
onTimeoutStart
-function.Functionality is the same as for the
onTimeoutStart
-function.button
, key
, items
, fx
, easing
, duration
, pauseOnHover
, queue
, event
, conditions
, onBefore
, onAfter
and onEnd
.This object is the same as the scroll
object, except for button
and key
. What is not specified in this object, will be inherited from the scroll
object.
prev.button
or prev.key
.prev.key
."up"
, "down"
, "left"
or "right"
.scroll.items
.scroll.fx
.scroll.easing
.scroll.duration
."auto"
to let the plugin calculate a speed for the transition instead of using a duration. This could be desirable when using the slideTo
event.
Note: The speed is calculated by deviding scroll.duration
by scroll.items
and multiplying it with the amount of items to scroll.
scroll.pauseOnHover
.scroll.queue
.scroll.event
.scroll.conditions
.scroll.onBefore
.scroll.onAfter
.scroll.onEnd
.button
, key
, items
, fx
, easing
, duration
, pauseOnHover
, queue
, event
, conditions
, onBefore
, onAfter
and onEnd
.This object is the same as the scroll
object, except for button
and key
. What is not specified in this object, will be inherited from the scroll
object.
next.button
or next.key
.next.key
."up"
, "down"
, "left"
or "right"
.scroll.items
.scroll.fx
.scroll.easing
.scroll.duration
."auto"
to let the plugin calculate a speed for the transition instead of using a duration. This could be desirable when using the slideTo
event.
Note: The speed is calculated by deviding scroll.duration
by scroll.items
and multiplying it with the amount of items to scroll.
scroll.pauseOnHover
.scroll.queue
.scroll.event
.scroll.conditions
.scroll.onBefore
.scroll.onAfter
.scroll.onEnd
.container
, keys
, anchorBuilder
, items
, deviation
, fx
, easing
, duration
, pauseOnHover
, queue
, event
, conditions
, onBefore
, onAfter
and onEnd
.This object is the same as the scroll
object, except for container
, keys
, anchorBuilder
and deviation
. What is not specified in this object, will be inherited from the scroll
object.
pagination.container
.pagination.keys
.Note: any page after page 9 will not be accessible via the keyboard.
If
null
, the public method pageAnchorBuilder
is used:$.fn.carouFredSel.pageAnchorBuilder: function(nr, item) {
return '<a href="#'+nr+'"><span>'+nr+'</span></a>';
};
This function receives 1 parameter:
nr // The page number.
false
, instead of building the pagination, the elements allready available in the container
will be used as anchors.scroll.fx
.scroll.easing
.scroll.duration
."auto"
to let the plugin calculate a speed for the transition instead of using a duration. This could be desirable when using the slideTo
event.
Note: The speed is calculated by deviding scroll.duration
by scroll.items
and multiplying it with the amount of items to scroll.
scroll.pauseOnHover
.scroll.queue
.scroll.event
.scroll.conditions
.scroll.onBefore
.scroll.onAfter
.scroll.onEnd
.onTouch
, onMouse
, options
, items
, fx
, easing
, duration
, pauseOnHover
, queue
, conditions
, onBefore
, onAfter
and onEnd
.This object is the same as the scroll
object, except for onTouch
, onMouse
and options
. What is not specified in this object, will be inherited from the prev
or next
object.
To enable this feature, you’ll need to include the jQuery.touchSwipe-plugin.
swipe.onTouch
.swipe.items
.scroll.fx
.scroll.easing
.scroll.duration
."auto"
to let the plugin calculate a speed for the transition instead of using a duration. This could be desirable when using the slideTo
event.
Note: The speed is calculated by deviding scroll.duration
by scroll.items
and multiplying it with the amount of items to scroll.
scroll.pauseOnHover
.scroll.queue
.scroll.event
.scroll.conditions
.scroll.onBefore
.scroll.onAfter
.scroll.onEnd
.items
, fx
, easing
, duration
, pauseOnHover
, queue
, conditions
, onBefore
, onAfter
and onEnd
.This object is the same as the scroll
object. What is not specified in this object, will be inherited from the prev
or next
object.
To enable this feature, you’ll need to include the jQuery.mousewheel-plugin.
scroll
object.mousewheel.items
.scroll.fx
.scroll.easing
.scroll.duration
."auto"
to let the plugin calculate a speed for the transition instead of using a duration. This could be desirable when using the slideTo
event.
Note: The speed is calculated by deviding scroll.duration
by scroll.items
and multiplying it with the amount of items to scroll.
scroll.pauseOnHover
.scroll.queue
.scroll.event
.scroll.conditions
.scroll.onBefore
.scroll.onAfter
.scroll.onEnd
.Note: In all callback functions, this
refers to the HTML-element of the carousel.
Except for the auto.progress.updater
-callback function, where it refers to the HTML-element of auto.progress.bar
; and the pagination.anchorBuilder
-callback function, where it refers to the HTML-element of the current item.