Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.18 KB

README.md

File metadata and controls

43 lines (30 loc) · 1.18 KB

Titanium Accordion Menu

Implementation of an accordion menu for Titanium apps. Currently only tested on Android. This repo is a demo app, the only file you need to paste into your project is "app/lib/accordion.js".

Usage

  1. Create a container view for the menu items, and set the attribute "accordion" to "true":

    <View id="myView" accordion="true"> ... </View>

    OR...

    var view = Titanium.UI.createView( {accordion: "true", id: "myView"} );
  2. Add elements to the container. The first child element will be assigned the click event handler, and the rest of the children will be hidden when the accordion is collapsed.

  3. Import the module:

    var accordion = require("accordion");
  4. Initialize your view

    $.window.open();
  5. Run the module:

    var depth          = -1;      // no max tree search depth
    var startCollapsed = true;    // initial accordion state is collapsed
    var root           = $.window // this can be element that is a parent of the $.myView
    function callback (containerView) {}; // called when an accordion menu is toggled
    accordion.setup(root, depth, startCollapsed, callback);