Home arrow HTML arrow Page 4 - Completing a Bulleted Menu Of Links
HTML

Completing a Bulleted Menu Of Links


In the previous part of this two-part tutorial, I began describing how to build a bulleted menu of links, such as you might see on many web sites. These links unfold, so that some headings, when clicked, reveal links below them to pages that are subcategories. In this second part, I will jump right back into the subject, starting with the JavaScript code we need to accomplish the magic.

Author Info:
By: Chrysanthus Forcha
Rating: 4 stars4 stars4 stars4 stars4 stars / 3
March 02, 2009
TABLE OF CONTENTS:
  1. · Completing a Bulleted Menu Of Links
  2. · The expandOrCollapse(leftIDpart, rightIDpart) Function
  3. · Global Variables
  4. · Still on Second Level Event
  5. · Other List-Item Markers

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Completing a Bulleted Menu Of Links - Still on Second Level Event
(Page 4 of 5 )

Note that the list blocks are nested. All of the expandable LI elements call the previously-described function, through the “splitID(ID)” function. When you click a second level LI element, the parent LI element also receives the click. So the above function is called first by the second level LI element and automatically by the parent first level element, without the user knowing.

We need to prevent the call from the parent LI element from having any effect. The second innermost block we have just talked about handles the click from a second level LI element. The former innermost block we talk about handles the click from a first level LI element. Just before the former innermost block does its work, the condition SndLBullet == false has to be satisfied.

Again, as the function is called twice, the expandOrCollapse() function is called first by the second level LI click. So the second innermost block is executed first, and not the first innermost block. While it is executed, it sets the SndLBullet variable to true.

When the expandOrCollapse() function is called again, because the parent first level LI received a click automatically, the first innermost block is supposed to be executed. However, it would not be executed because the condition SndLBullet == false would not be satisfied, since SndLBullet is true.

Well, just after the first innermost block, under the rightIDpart.length == 1 condition, the SndLBullet variable is set to false (the initial value) again. So if the user clicks a first level LI element, its corresponding innermost block will not be prevented from being executed.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials