zui.ScrollSnapper Class
ScrollSnapper is a ScrollView plugin to replace YUI3 ScrollViewPaginator.
Constructor
zui.ScrollSnapper
()
Item Index
Attributes
Methods
_scrollEnded
()
protected
internal scrollEnd event handler
_updatePages
()
protected
Update page positions
_updateSnap
()
protected
Update current page positions when scrollView width/height changed
next
()
Scroll to the next page in the scrollview, with animation
prev
()
Scroll to the previous page in the scrollview, with animation
scrollTo
-
page
-
duration
-
easing
Scroll to a given page in the scrollview
snapIndex
()
Get nearest page index
snapTo
-
page
Snap to a page, same as set('index', page)
Parameters:
-
page
Numberpage index, start from 0
Attributes
index
Number
The active page number for a paged scrollview
Default: 0
Fires event indexChange
Fires when the value for the configuration attribute index
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
selector
String
CSS selector for a page inside the scrollview. The scrollview will snap to the closest page.
Fires event selectorChange
Fires when the value for the configuration attribute selector
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
snapDuration
Number
The active page number for a paged scrollview in micro seconds
Default: 500
Fires event snapDurationChange
Fires when the value for the configuration attribute snapDuration
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
total
Number
The total number of pages
Default: 0
Fires event totalChange
Fires when the value for the configuration attribute total
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added: