• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Accordion (gallery-accordion) on cdn

    Last Updated: 03/27/11
    + 15 -

    Iliyan Peychev

    YUI Contributor

    See 1 more by this user.

    Featured Item

    Created: 10/23/09
    Last CDN Push: 08/15/12
    Build Tag: gallery-2012.08.15-20-00
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.3.0
    Free for use.
    Accordion is a visual widget that allows the expansion/collapse of grouped items containing arbitrary data.
    These items can be:
    • added or removed dynamically
    • closed
    • set as always visible
    • reordered via drag and drop.
    http://farm3.static.flickr.com/2707/4038539087_6ee055de0e.jpg
    • Tags:
    • accordion
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Build Accordion from script and add three items dynamically.

    Code Sample

    <script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2012.08.15-20-00'
    }).use('gallery-accordion', function(Y) {
        var item1, item2, item3, accordion;
     
        accordion = new Y.Accordion({
            srcNode: "#acc1",
            useAnimation: true,
            collapseOthersOnExpand: true
        });
     
        accordion.render();
     
        item1 = new Y.AccordionItem( {
            label: "Item1, added from script",
            expanded: true,
            id: "dynamicItem1",
            contentHeight: {
                method: "fixed",
                height: 80
            },
            closable: true
        } );
     
        item1.set( "bodyContent", "This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"fixed, 80px\"." );
     
        accordion.addItem( item1 );
     
        item2 = new Y.AccordionItem( {
            label: "Item2, added from script",
            expanded: true,
            id: "dynamicItem2",
            contentHeight: {
                method: "stretch"
            }
        } );
     
        item2.set( "bodyContent", "This is the body of the item, added dynamically to accordion, before item1.<br>Content height has been set as \"stretch\"." );
     
        accordion.addItem( item2, item1 );
     
        item3 = new Y.AccordionItem( {
            label: "Item3, added from script",
            expanded: true,
            alwaysVisible: true,
            id: "dynamicItem3",
            contentHeight: {
                method: "auto"
            }
        } );
     
        item3.set( "bodyContent", "<div style='position:relative;'>This is the body of the item, added dynamically to accordion.<br>Content height has been set as \"auto\".</div>" );
     
        accordion.addItem( item3 );
     
    });

    Forum Posts

    Subject Author Date
    w3c validation fails Jeff Flesher 11/3/09
    Re: w3c validation fails Iliyan Peychev 11/4/09
    Re: w3c validation fails Iliyan Peychev 11/10/09
    Scrollable KReiss 12/15/09
    Re: Scrollable Iliyan Peychev 12/16/09
    Re: Scrollable KReiss 12/16/09
    Re: Scrollable Iliyan Peychev 12/16/09
    Forcing an item to expand alexlebek 01/14/10
    Re: Forcing an item to expand Iliyan Peychev 01/14/10
    Re: Forcing an item to expand alexlebek 01/15/10

    © 2006-2013 Yahoo! Inc. All rights reserved.
    All code on this site is licensed under the BSD License unless stated otherwise.
    About This Site · Security Contact Info