JavaScript application instance: web page collapse Menu

Source: Internet
Author: User
javascript| Menu | web | application Example

JS Library from:http://moofx.mad4milk.net/(MOOFX Super lightweight Javascrip effect class library)

Just click here to see the effect.

Usage:

1. Add JS Library

CODE:
<script src= "Prototype.lite.js" type= "Text/javascript" ></script>
<script src= "Moo.fx.js" type= "Text/javascript" ></script>
<script src= "Moo.fx.pack.js" type= "Text/javascript" ></script>

2. Establish the XHTML structure:

CODE:
<div id= "Container" >

<div class= "Content" >
<p> (1) Place content </p>
</div>

<div class= "Content" >
<p> (2) Place content </p>
</div>

<div class= "Content" >
<p> (3) Place content </p>
</div>
</div>

3. Call JS:

CODE:

<script type= "Text/javascript" >
Define the number of contents groups for all the content that will be displayed
var contents = document.getelementsbyclassname (' content ');
Defines the number of contents groups as all headings, as well as clickable expansion buttons
var toggles = document.getelementsbyclassname (' title ');

Call MOOFX JS Library
var myaccordion = new FX. Accordion (
Toggles, contents, {opacity:true, duration:400}//opacity Determine whether there is alpha transparency change, duration determine the action all the time
);
Myaccordion.showthishideopen (Contents[0]); Open first content by default
</script>

Complete.
It's simple and it works.
If you want to have a good interface, customize the CSS Bar

Download



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.