Configurations
- triggers(Boolean, String, jQuery)
- If set to
false
, triggers will be disabled.
- If set to
true
, triggers will be created automatically, and the texts are natural numbers.
- If set to a string, triggers will also be created automatically, and the string is triggers’s text.
- If set to a jQuery object, just it is.
- Defaults to
true
.
- putTriggers(String)
- Defaults to
"insertAfter"
.
- triggersWrapCls(String)
- Class name for triggers’s parent element. This option will be available when the triggers were created automatically.
- Defaults to
"switchable-triggers"
.
- currentTriggerCls(String)
- Class name for current trigger.
- Defaults to
"current"
.
- panels(Selector, jQuery)
- Use a selector or a jQuery object to set panels.
- Defaults to
null
and will use .children()
method to get panels from the container.
- steps(Integer)
- Set the number of panels which switch together.
- Defaults to
1
.
- triggerType(String)
mouse
or click
. If set to mouse
, click event is also available.
- Defaults to
"mouse"
.
- delay(Number)
- Set the delay time of trigger event in seconds when
triggerType
is mouse
.
- Defaults to
0.1
seconds.
- initIndex(Integer)
- Specifies the panels those are initially displayed when the page loads. A negative integer is available.
- Defaults to
0
and will start on the first panel.
- effect(String)
-
The effect to be used when panels are switching. Here are the available built-in effects:
none
: a simple show/hide effect.
fade
: panels are gradually shown from zero to full opacity.
scrollLeft
, scrollRight
, scrollUp
, scrollDown
: as the name suggests. The scrollRight
and scrollDown
effects will take effect only when panels autoplay.
accordion
, horizAccordion
: as the name suggests.
- Defaults to
"none"
.
- easing(String)
- Set the easing of the switch animation.
ease
, linear
, ease-in
, ease-out
, ease-in-out
, cubic-bezier(x1, y1, x2, y2)
are available.
- Defaults to
"ease"
.
- duration(Number)
- Set the duration of the switch animation in seconds.
- Defaults to
0.5
seconds.
- loop(Boolean)
- When switch to the first / last panel, whether switch to the last / first panel.
- Defaults to
true
.
- beforeSwitch(Callback)
- Function called before switch animation. If it returns
false
, the switch will be stopped.
- The
this
variable points to the API.
- Defaults to
null
.
- onSwitch(Callback)
- Function called at the start of switch animation.
- Defaults to
null
.
- api(Boolean)
- Defaults to
false
.
Properties
- config(Returns: Object)
- Returns the configuration object for the jQuery.Switchable instance. This object can be modified and the changes are dynamically reflected in the behaviour of the instance.
- container(Returns: jQuery)
- Returns the container for the panels as a jQuery object.
- triggers(Returns: jQuery)
- Returns the triggers as a jQuery object.
- panels(Returns: jQuery)
- Returns the panels as a jQuery object.
- length(Returns: Integer)
- Returns the amount of panel groups.
- index(Returns: Integer)
- Returns the current index number.
- willTo( [isBackward] )(Returns: Integer or Boolean)
- Returns the index number of the panels will be displayed, generally used when the
autoplay
is set to true
. If returns false
, means that the animation has been stopped.
Methods
- switchTo( toIndex[, direction] )(Returns: API)
In addition to the above common API, some effects and plugins have their own API:
Configurations
- end2end(Boolean)
- Defaults to
false
.
- groupSize(Array)
- Defaults to
[]
.
- visible(Integer)
- Defaults to
null
.
Accordion Effects
Configurations
- initIndex(Integer)
- The new value
null
is available. If set to null
, panels are all hidden when the page loads.
- multiple(Boolean)
- Defaults to
false
.
- customProps(Object)
- Defaults to
{}
.
Autoplay Plugin
Configurations
- autoplay(Boolean)
- Defaults to
false
.
- interval(Number)
- Defaults to
3
seconds.
- pauseOnHover(Boolean)
- Defaults to
true
.
Property
- paused(Returns: Boolean)
Methods
- play()(Returns: API)
- pause()(Returns: API)
Carousel Plugin
Configurations
- prev(Selector, jQuery)
- Defaults to
null
.
- next(Selector, jQuery)
- Defaults to
null
.
Properties
- prevBtn(Returns: jQuery)
- nextBtn(Returns: jQuery)