Home arrow JavaScript arrow Building Collapsible Navigation Bars with the Prototype Library
JAVASCRIPT

Building Collapsible Navigation Bars with the Prototype Library


Welcome to the second part of a four-part series on creating collapsible navigation bars with CSS and JavaScript. In this installment, I explain how to create a simple navigation bar that can be hidden and displayed alternately. We'll use the Prototype and Scriptaculous JavaScript libraries to achieve this effect.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
September 28, 2009
TABLE OF CONTENTS:
  1. · Building Collapsible Navigation Bars with the Prototype Library
  2. · Building a sample web page
  3. · Adding dynamic behavior to a static navigation bar with the Prototype JavaScript library
  4. · The dynamic navigation bar’s full source code

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Building Collapsible Navigation Bars with the Prototype Library
(Page 1 of 4 )

Introduction

Developing a basic navigation bar for a web site is a pretty simple process that can be tackled even by inexperienced designers. Most of the time, this procedure only requires grouping links into an HTML list, and then spicing them up with a few CSS styles. That's it; mission accomplished!

Nonetheless, things can be a bit more complicated when it’s necessary to build a navigation mechanism that must have some kind of dynamic behavior. For instance, say that you want to create a links bar on top of a web page, and give users the possibility of hiding and revealing it alternately. In this case, creating a small JavaScript application that turns this navigation bar on and off may be an adequate solution, but this may restrict its overall accessibility.

Fortunately, there are alternatives when it comes to building a dynamic navigation bar like the one described above. It is perfectly possible to create it by using a proper combination of JavaScript and CSS. Best of all, it’ll remain completely functional even if scripting is disabled on the browser.

Of course, if you read the first article of this series, you're already pretty familiar with constructing a web-based navigation mechanism that can be hidden and displayed alternately by means of a simple switcher. I gave you the full details on how to perform this process in that tutorial.

However, you should recall that the JavaScript application that I developed in the previous chapter, while aimed at turning a static navigation bar into a dynamic user interface, was pretty basic. It lacked an important feature: it can’t be easily expanded.

Therefore, taking this limitation into account, in this second tutorial I’m going to teach you how to build a similar navigation system, this time by using the functionality of Prototype, the popular JavaScript library. In doing so, not only will the whole source code of this dynamic navigational bar look much more modular and compact, but it’ll support the incorporation of different animation effects.

That being said, to learn more about how this will be accomplished, start reading!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

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