
Solid, safe website tools.
Whatever your need, Will Bontrager builds powerful software solutions.
|
(Get Attention Ticker for your web site)
Quick 'N Easy Layer Show/HideBy Will Bontrager This post shows how to hide content that becomes visible when a link is clicked or mouse hovers over it. This is one of three related posts. Each has different features. See this comparison table:
This is the "Quick 'N Easy Layer Show/Hide" article. If you've been holding off on creating sections of your web page to show or hide on demand because you were uncertain exactly how to implement it, hold off no more. This is what I'm referring to: Click here to show/hide example text. The JavaScript is copy 'n paste ready. It includes functions to show/hide, like the above example text, and also functions to only show and to only hide. This is the JavaScript: Now, we'll talk about how to prepare the content and the link(s). Prepare the content like this: The "uniquename" for the id needs to be different than any other id on the web page. We'll assume an id of "uniquename" for the rest of the examples. The style="display:none;" hides the content when the web page first loads. If you want to show the content when the web page first loads, remove that attribute from the div tag. Three different links are available. The links can be located anywhere on the web page, although near the content to be shown/hidden is the usual.
Notice that the id's name is specified in each of the above links. Change 'uniquename' to be the id name of the content div you wish to effect. Once you've implemented it a time or two, you'll see how easy it really is.
And that's it :) One more thing: If you wish to let the show/hide occur when the mouse hovers over the link, instead of occurring when the link is clicked, add an onmouseover attribute to the link and give the href attribute a URL. Example: If no URL is desired for the link, "#" can be used instead. January 30, 2006 Please note: Articles on this website are presented "as is". However - If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Rate this blog post.
No page reload! |
||||||||||||||||||||||||||||||
|
© 1998-2001 William and Mari Bontrager |
||||||||||||||||||||||||||||||