API Docs for: 0.0.1
Show:

zui.ScrollSnapper Class

Extends Plugin.Base
Module: gallery-zui-scrollsnapper

ScrollSnapper is a ScrollView plugin to replace YUI3 ScrollViewPaginator.

Constructor

zui.ScrollSnapper

()

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

Parameters:

  • page Number

    page index, start from 0

  • duration Number

    The number of ms the animation should last

  • easing String

    The timing function to use in the animation

snapIndex

()

Get nearest page index

snapTo

(
  • page
)

Snap to a page, same as set('index', page)

Parameters:

  • page Number

    page 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 EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

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 EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

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 EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

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 EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.