View Full Version : Conditionally Displaying an Image and Description


Opv
04-23-2004, 06:49 PM
I am wanting to design a DIV which contains contains both an IMAGE and a detailed DESCRIPTION of that image based on the name of a person selected from either a dropdown menu or selected from a list. Additioanlly, I want to build in the ability to show/hide the DIV at will.

This is not a slide show, per se. The intent is for visitors to see a list of names for the Board of Directors for an organization and to be able to click on a name and a display appear that shows that person's picture and associated description.....then when finished viewing, hide the display.

Any thoughts as to how to most simply accomplish this?

Opv

Calidris
04-23-2004, 07:56 PM
1) Create a DIV for each Director
2) Position all of the DIVs with CSS (position: absolute; etc etc)
3) Make your little drop-down-box
4) Give each option in the box a value (e.g. <option value="DirectorOne">) and each DIV an ID that is related to that value (e.g. <div id="DirectorOne">)
5) Use some javascript to change the z-index of the DIV to put it on top of the others.

I might do it all for you as practice, I like to keep my JavaScript up to scratch - but I think you would find it more rewarding to do it for yourself :)

Opv
04-24-2004, 04:27 PM
Thanks for the offer. I have nine DIVs in my document, each one containing the picture and description for each Board member. I can handle everything but the Javascript to continuously hide all of the DIVs except the one selected from the menu.

Calidris
04-24-2004, 10:50 PM
It would be easier to put all nine DIVs on top of each other with a z-index of 0.
Then... when the user chooses from the selection box, it adds to the z-index of the right DIV.

As a tip: you should keep the z-index as a running total, so whenever you change DIV, add 1 to the total and give that value to the DIV :)

Opv
04-27-2004, 12:00 AM
Well, I've got the Javascript working. It seems to be doing what I want it to.
Thanks for your help.

Opv