iUIScroll

iUIScroll is an implementation of iScroll library for iUI.

iUIScroll
Author: Remi Grumeau
Version: 1.1
See also
- Getting Started
- Frequently Asked Questions
- iUI code documentation
- Advanced styling & themes
Get Involved
Like in most open-source projects, the more we are, the meyer it is! HTML/CSS/JS, documentation, design, translation, ...
Don't be shy
1. Instructions for use

Just add a classname "iuiscroll" to the main div/ul/form of the page, and an id value to '_scroller' prefixed by the main id name

GOOD : default + default_scroller

<div id="default" title="Default" class="iuiscroll">   <div id="default_scroller">     This text is scrollable   </div> </div>

GOOD : default + default_scroller

<div id="default" title="Default" class="iuiscroll">   <div>     <div id="default_scroller">       This text is scrollable     </div>   </div> </div>

WRONG : music + default_scroller (should be music + music_scroller)

<div id="music" title="Music Demo" class="iuiscroll">   <div id="default_scroller">     Album 1   </div> </div>

GOOD : default + default_scroller + default_footer

<div id="default" title="Default" class="iuiscroll">   <div>     <div id="default_scroller">       This text is scrollable     </div>   </div>   <div id="default_footer">     footer content   </div> </div>

2. Variables

2.1. iui.iScroll.myScroll (iScroll object)
Default is null, set by activeScroller.

It is set on afterTransition by the function activeScroller() and use by setHeight().
To access all iScroll functions like destroy() or refresh() (see iScroll website for more infos).
Ex: "home_scroller", "music_scroller", ...

3. Functions

3.1. iui.iScroll.activeScroller (function)
Loaded once on load, and after each 'afterInsert' iUI event

It selects all iUI screens (aka DOM element with id & title attributes) with a classname to 'iuiscroll', their child DOM elements with id attribute equal to parents ID + '_scroller'.

For each match, it adds an 'afterTransition' event listener that:
- set iScroll object height using setHeight()
- destroy existing iScroll objects
- declare a iScroll object on this DOM element


3.2. iui.iScroll.setHeight(page) (function)
Loaded on each 'afterTransition' iUI event on iScroll-enable screens
- page (string)

Use page, or iui.getSelectedPage() if empty.
Detect toolbar height, and if present in the DOM for this screen, footer height too. It then set height & min-height of the scroller based on window height - ( toolbar height + footer height).

For each match, it adds an 'afterTransition' event listener that:
- set iScroll object height using setHeight()
- destroy existing iScroll objects
- declare a iScroll object on this DOM element