More Divisions
This is a great effect if you have a series of links down one side of the page. The effect of multiple divisions appearing one after the other looks high-tech and appears interactive. The only downfall, if you want to call it that, is that each of these divisions are an element in their own right. They each have a NAME attribute assigned. Thus...you need to create a totally new function to make the division appear and disappear.
For example, let's say you already have the division described in this tutorial installed on a page. You want a second one. Here's what you need to do:
- Create a whole new function that makes the division appear. The easiest method would be to copy and paste the current appear function and change its name. The current appear function is named ShowIt(). You could simply change the name to ShowIt2().
- You need to go into the division itself and change out:
- The TOP and LEFT positioning pixels
- The NAME of the division
- What is contained in the division
- Finally, copy and paste the function that makes the first one disappear. Again, you need to make a few changes:
- The name of the function. The current function is named LoseIt(). You could simply change the new function name to LoseIt2().
- The NAME element of the innerHTML and outerHTML statements. Remember that they are currently attached to the first division named "TheTip". You need to change "TheTip" to whatever you named this new division.
Now you're good to go with a second division. Yes, it's a little work, but the results are great.
A Final Note
While working on this tutorial, I played with multiple and single divisions. I can honestly say that what makes these things really shine is the positioning element. Where they pop up is really the point of all of this, more so than the fact that they pop up at all. I found that you can't be overly precise, but get close. Or don't. I loved the look of an element on the left side of the page popping a window on the right. Got it? Great. Now go learn to
DHTML Example #8-- Toggling with Netscape
.
Enjoy!
[Toggling with MSIE]
[
DHTML Example #8-- Toggling with Netscape
]
[Make the Division Appear] [Make the Division Disappear]
[Call For the Disappear] [More Divisions]
Please note that this article also constitutes Part 3 of our "Layers" series. To view part 4 of that series see:
So You Want to Move A Layer, Huh?