new UWA.Controls.Carousel(element, options)
UWA.Controls.Carousel constructor.
Parameters
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
Element | Parent HTML element of items to scroll (e.g. <UL>). |
||||||||||
options |
Object | Options hash or a option/value pair. Properties
|
Extends
- UWA.Controls.Abstract
Mixes In
- UWA.Controls.Timed
Index
Methods
- scrollHead
- scrollTail
- scrollNext
- scrollPrevious
- scrollToItem
- scrollTo
- isItemVisible
- getFirstItemVisible
- getLastItemVisible
- getVisibleItems
- nextButton
- previousButton
- initEvents
- onScrollButtonClick
- onScrollButtonDblClick
- autoScrollNext
- autoScrollPrevious
- autoScroll
- stopScroll
- onRefresh
- updateScrollButtonsDisabledState
- hasOverflow
- isVertical
- getItems
- isInjected
- getScrollButtonFromEvent
- _createScrollButton
Methods
-
scrollHead(duration)
-
Scroll to the first item.
Parameters
Name Type Description duration
Number Animation duration (optional)
Returns: * Nothing.
-
scrollTail(duration)
-
Scroll to the last item.
Parameters
Name Type Description duration
Number Animation duration (optional)
-
scrollNext(numItems)
-
Scroll the carousel forward.
Parameters
Name Type Description numItems
Number The number of items to scroll (optional)
-
scrollPrevious(numItems)
-
Scroll the carousel backward.
Parameters
Name Type Description numItems
Number The number of items to scroll (optional)
-
scrollToItem(item, duration)
-
Scroll carousel to the specified item element.
Parameters
Name Type Description item
HTMLElement The item element to scroll
duration
Number Animation duration (optional)
-
scrollTo(direction, numItems, duration)
-
Scroll carousel to the specified item element index.
Parameters
Name Type Description direction
String TODO
numItems
Number TODO
duration
Number Animation duration (optional)
-
isItemVisible(item, partially) → {Boolean}
-
Whether or not the tab item is fully visible.
Parameters
Name Type Description item
HTMLElement The item element to test visibility
partially
Boolean False to exclude if partially visible. Default: True
Returns
- Type
- Boolean
-
getFirstItemVisible() → {HTMLElement}
-
Returns the first item element strictly visible.
Returns
- Type
- HTMLElement
-
getLastItemVisible() → {HTMLElement}
-
Returns the last item element strictly visible.
Returns
- Type
- HTMLElement
-
getVisibleItems(partially) → {Array}
-
Returns all items elements currently visible (not overflow hidden).
Parameters
Name Type Description partially
Boolean true
to also return items partially visibleReturns
An array of HTMLElement.
- Type
- Array
-
nextButton() → {HTMLElement}
-
Returns the Scroll forward button.
Returns
- Type
- HTMLElement
-
previousButton() → {HTMLElement}
-
Returns the Scroll backward button.
Returns
- Type
- HTMLElement
-
initEvents()
-
Initialize UI events.
-
onScrollButtonClick()
-
Click event on scroll buttons.
-
onScrollButtonDblClick()
-
Double click event on scroll buttons.
-
autoScrollNext()
-
Performs a continuous scroll forward until stopScroll() is called.
-
autoScrollPrevious()
-
Performs a continuous scroll backward until stopScroll() is called.
-
autoScroll()
-
Performs a continuous scroll backward until stopScroll() is called.
-
stopScroll() → {Boolean}
-
Stop dragScroll if started. Stop autoScrolling if started.
Returns
true
of autoScrolling has been stopped.- Type
- Boolean
-
onRefresh()
-
Same than onRefresh()
-
updateScrollButtonsDisabledState()
-
Enable/disable scroll buttons.
-
hasOverflow()
-
Whether or not carousel has its content in overflow.
-
isVertical()
-
Whether or not carousel orientation is vertical.
-
getItems() → {Array}
-
Returns all scrollable child elements.
Returns
An array of HTML elements.
- Type
- Array
-
isInjected() → {Boolean}
-
Whether or not carousel is injected into document.
Returns
- Type
- Boolean
-
getScrollButtonFromEvent(e) → {Tab}
-
Helper method to retrieve the scroll button instance from a Browser event.
Parameters
Name Type Description e
Event Browser event
Returns
Closest scroll button on which event happened.
- Type
- Tab
-
_createScrollButton()
-
Private method for nextButton() / previousButton()