DHTML
  Home arrow DHTML arrow Page 2 - Cross Fading Navigation with DHTML
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  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
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? 
DHTML

Cross Fading Navigation with DHTML
By: Justin Cook
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2004-03-10

    Table of Contents:
  • Cross Fading Navigation with DHTML
  • Putting our Items in Place
  • Into the Code
  • The Fading Function
  • In Retrospect...

  • 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Cross Fading Navigation with DHTML - Putting our Items in Place


    (Page 2 of 5 )

    First, we might need an area to contain main navigation. We’ll call it navRowMain, and place our top level items within:


    <div id=”navRowMain”
     
    <a href=/” onMouseOver=”swapNav);>Acme Inc.</a> |
     
    <a href=/services/” onMouseOver=”swapNav);>Products Services</a> |
     
    <a href=/success/” onMouseOver=”swapNav);>Success Stories</a>
    </div>

    You’ll notice that each item is a link. This is to allow for browsers incapable of handling the DHTML, perhaps on a PDA. This way, they still have the option of navigating to the default page for each section, which should provide hard links to where they want to go. You also see the call to the swapNav( # ) function for each onMouseOver event, but before we get into that, let’s build our sub-level navigation.


    <div id="navRowSub">
      
    <span id="nav1" class="subNav">
        
    <a href=/>home</a> |
        
    <a href=/company.aspx”>about the company</a> |
        
    <a href=/locations.aspx”>locations</a> |
        
    <a href=/contact.aspx”>contact</a>
      
    </span
      
    <span id="nav2" class="subNav">
        
    <a href=/products.aspx”>products</a> |
        
    <a href=/services/business.aspx”>business services</a> |
        
    <a href=/services/residential.aspx”>residential services</a>
      
    </span
      
    <span id="nav3" class="subNav">
        
    <a href=/success/>recent</a> |
        
    <a href=/success/archives.aspx”>archived</a>
      
    </span>
    </div>

    So, all of our items are in place, but before we jump into the code, we must first set the CSS styles. You can define whatever styles you need to; just make sure you include the following:


    <style type="text/css">
    <!--
      
    .subNav {
        display
    :none;
      
    }
     
      
    #navRowSub {
        height: 12px;
        filter: alpha( opacity = 100 );
        -moz-opacity:1;
      }
    -->
    </style>

    Firstly, this tells each of our sub-level items to not display, because we’ve defined class="subNav" for each of them. Secondly, it defines the initial opacity of the whole block, which is essential to our modifying it. Unlike many styles, you can not modify the opacity filter on an object unless it has a defined initial value.

    NOTE  You also have to set the height property, otherwise the script refuses to work in IE for some reason.

    More DHTML Articles
    More By Justin Cook


     

    DHTML ARTICLES

    - Text-Justify, Volume, and Other Style Sheet ...
    - Ruby-Position, Size, and Other Style Sheet P...
    - Padding, Pages, and More Style Sheet Propert...
    - Marks, Orphans, and More Style Sheet Propert...
    - Layouts, Margins, and Other Style Sheet Prop...
    - Floats, Fonts, and Other Style Sheet Propert...
    - Color, Filters, and Other Style Sheet Proper...
    - Borders and More with Style Sheets
    - Learning Style Sheet Properties
    - Style Sheet Property Reference
    - Completing a Noisy Image Application
    - An Object-Based Approach to Building Noisy I...
    - A Basic Method for Building Noisy Images
    - Adding More Features to Sliders with the Scr...
    - Using Sliders with the Scriptaculous Framewo...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway