/CSS/ Sort out your drawers

24/03/2008 | Filed under Develop > CSS

Craig Grannell provides you with a quick, easy and modular solution for creating website drawers, using a lean little script that’s just hundreds of bytes in size

Sometimes, there’s not enough room onscreen for all the information you want to provide, or your web page contains supplementary information that you don’t want to display because it distracts users from the main content. In cases like these, drawers have become a popular way of adding to your page’s effective real estate, enabling you to hide content behind a clickable component, only displaying the content when users request it.

Various methods exist for creating drawers, including solutions built into popular applications, components of libraries such as Scriptaculous, and freely available JavaScript solutions on the web. The problem with application solutions and libraries is that the code can be weighty. If you just want some drawers, there’s no point in forcing users to download large library files. As for web solutions, most of them work on the basis of single targets. In other words, the trigger toggles the display property of an element with a specific id. That’s fine if you only want a single drawer, but when you have plenty, a system like this can be tedious to work with.

In this tutorial, you’ll find out how to use an efficient piece of JavaScript to create drawers in a modular fashion. As long as you use the same basic structure for each drawer, the set-up remains identical throughout, saving you having to faff about with id values!


About the author:

Name: Craig Grannell
Site: www.snubcommunications.com
Areas of expertise: Information architecture, site concepts, graphics, interface and front-end design
Clients: Swim~, Rebellion, IDG
Favourite holiday food: Decent, authentic Mexican

Click here to download the support files
Click here to download tutorial PDF

 

Add a comment

Your name:


Your email: (Not displayed)


Your website: (optional)


Enter your comment here:

Issue 179

.net issue 179 is now on sale! Craft better sites, be inspired by the next generation of web design trends, and learn how to create the perfect newsletter. Find out more ...

» Subscribe and save 40%
» Buy issue 179
» Get a corporate subscription
» Join us on Facebook



ADVERTISEMENT FEATURE

Let your creativity fly

Adobe® Creative Suite® 3.3 Design Premium now includes Acrobat® 9 Pro and Fireworks® CS3, a lower price and a bonus training DVD worth £50.
 
Win with .net

The latest competitons from .net magazine

Signup for our newsletter

Enter your email address and start receiving our new-look weekly email newsletter!

 
 

Rackspace Managed Hosting

TopHosts

actinic

.net photos powered by:
Canon