Design Usability
  Home arrow Design Usability arrow Page 5 - Easy as A,B,C – dynamic A to Z indexes
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? 
DESIGN USABILITY

Easy as A,B,C – dynamic A to Z indexes
By: Chris Heilmann
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 28
    2005-03-30

    Table of Contents:
  • Easy as A,B,C – dynamic A to Z indexes
  • Our friend the user agent
  • The Redmond spoiler
  • Making the list dynamic
  • Customizing the script

  • 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


    Easy as A,B,C – dynamic A to Z indexes - Customizing the script


    (Page 5 of 5 )

    The script needs several classes in the CSS and the appropriate IDs on the HTML element to add the effect. This was done to allow complete control over the look and feel without changing the JavaScript. The IDs make the script a lot faster as we can access elements by their ID rather than looping through all of them.

    The IDs are:

    atoz

    The A to Z list navigation; this can be in any format, as the script loops through the links contained within it. The best option is an unnumbered list, though.

    contents

    The element containing all the different sections from A to Z, normally a DIV.

    The classes are:

    hidden

    hides the section to which it is applied

    shown

    shows the section that was previously hidden

    current

    applied to the current link

    dohover

    applied to the atoz element to indicate that the effect should be applied when you mouse over it, and not only when you click it.

    All these settings can be changed in the first few lines of the script:

                // check if necessary elements are available

                var n=document.getElementById('atoz');

                var c=document.getElementById('contents');

                // Define the classes in use to show and hide the elements

                var hc='hidden';

                var sc='shown';

                var cc='current';

                var mc='dohover';

    Saving even more screen estate

    Long lists are boring to look at, and the need to scroll the screen can be very annoying. We aligned our A to Z navigation horizontally; why not do the same with the content lists? All we need to add is a style that defines a width for each of the list elements and floats them to the left:

    #contents.columns li{

                float:left;

                width:10em;

    }

    The link pointing back to the navigation needs to clear each float, otherwise following sections might be indented:

    #contents.columns p.back2{

                clear:both;

    }

    Now we have a dynamic A to Z index that takes up the least possible screen estate (example:columnatoz.html). The list items do get arranged horizontally, not vertically. If we wanted to arrange them vertically, we’d need to resort to more excessive use of CSS and messy HTML suffering from “classitis” (the overuse of classes in the HTML, effectively mixing structure with presentation). There is an article on the subject of multicolumn lists explaining all the ins and outs at Community MX [2].

    Links

    [1] http://www.jimthatcher.com/skipnav.htm - Internet explorer bug concerning anchors and keyboard navigation.

    [2] http://www.communitymx.com/content/article.cfm?cid=27F87  - Multi column lists with CSS.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Very neat article. I should have loved to get a little more about the javascript,...
     

    DESIGN USABILITY ARTICLES

    - Create Great JavaScript and CSS Menus Simply
    - Design Principles that Shape a Web Site
    - Creating Aqua Style Images
    - Easy as A,B,C – dynamic A to Z indexes
    - EasyChart: a Usability Teaching Tool to Demo...
    - Building Friendly Pop-up Windows
    - Back to School: Design Usability
    - Using HTML_QuickForm To Manage Web Forms, Pa...
    - Using HTML_QuickForm To Manage Web Forms, Pa...
    - More Website Knick Knack
    - Browsers as Test Platforms
    - Website Knick Knack
    - Dynamic Page Elements-Cloak and Dagger Web D...
    - Accessibility and Dreamweaver MX 2004







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