JavaScript
  Home arrow JavaScript arrow Collapsible Navigation Bars with CSS and J...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Collapsible Navigation Bars with CSS and JavaScript
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-09-21

    Table of Contents:
  • Collapsible Navigation Bars with CSS and JavaScript
  • Start building a dynamic navigation bar
  • Adding behavior to the previous navigation bar
  • The complete source code for the dynamic navigation bar

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Collapsible Navigation Bars with CSS and JavaScript


    (Page 1 of 4 )

    In this first part of a four-part series, I will show you how to build a dynamic navigation bar that can be turned on and off by means of a simple switcher. This small web application will combine some JavaScript code, a few CSS styles and basic markup.

    Introduction

    When it comes to building eye-catching navigation bars for modern web sites, you know that there's a huge variety of approaches out there that can be used with relative ease. These range from purist solutions that only combine basic markup and a few CSS styles, to more complex methodologies, such as the ones that mix JavaScript, Ajax and Flash.

    While each of these approaches has its own pros and cons, there's a crucial point that must be taken into account when you choose a particular solution: a navigation bar must look professional, yet be accessible to most users. As you may guess, it'd be rather pointless to build such a navigation system by using the JScript functions and proprietary filters supported only by Internet Explorer, when visitors using other browsers won't be able to utilize them.

    However, it's perfectly possible to create navigation bars that take the best of each world: on the one hand they can be provided with a solid appearance and different dynamic behaviors, while on the other hand they can be easily accessed by most visitors.

    Does this sound like a utopia? It isn't, actually. To demonstrate the veracity of these concepts, in this group of articles I'm going to walk you through building a basic, yet efficient, web-based navigation bar which can be hidden and displayed alternately on a web page. I will use only a combination of simple JavaScript code, CSS styles and structural markup.

    Nonetheless, I'd like to stress again an important point here: this navigation bar will have dynamic behavior, but if scripting is disabled in the browser, it will  remain completely functional.

    In this first episode of the series, I'm going to teach you how to develop such a navigation mechanism by means of a pretty simple JavaScript application. This is a work in progress, though, so in upcoming tutorials, I'm going to show you how to get the same (or even better) results with the assistance of the Prototype JavaScript library.

    Now that you know what to expect from this introductory article, let's learn together how to build a dynamic navigation bar with JavaScript and CSS. Let's begin now!

    More JavaScript Articles
    More By Alejandro Gervasio


       · This first episode of the series shows how to develop a dynamic navigation mechanism...
     

    JAVASCRIPT ARTICLES

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 8 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek