Click to See Complete Forum and Search --> : Side menu like Outlook or Visio


Mig
01-04-2006, 10:54 AM
Does anybody know what I mean by one of those menus? They have like sections all in a vertical menu, and when you click on one, it will expand and push the others up or down out of the way, and display all the sub-headings in between. Anybody got a script to do that?

CrazyMerlin
01-04-2006, 10:59 AM
it's called an accordian component in some langauges

you could do this using div tags and a timer to get it to move smoothly, or without a timer to just have positioning.

you would use the style properties and attribures display:block and display:none

Mig
01-04-2006, 11:06 AM
Thanks. I didn't know what it was called, but now I can search for it a bit more.

CrazyMerlin
01-04-2006, 11:22 AM
basically set everything for each section inside a series of div tags with their style="display:none;" set

at the top of each div but just outside, add an input of type image and onclick="divname.style.display="block"

then in javascript, set the height of the div to the height of the outermost container - the height of a clickable image * the number of images

then when thre click is triggered move the top of the clicked div to the top of the outermost container - the height of the clickable image * the number of images 'above' the clicked one

when you change that top property, you do it using a setInterval() call to move the image and div by increments of say 5px every 250 milliseconds. You would need to experiment here to get a smooth effect.

but that's how you'd do it anyway, if you wanted to write it yourself

Mig
01-04-2006, 11:31 AM
Hmm... I wouldn't know how to write it myself in JavaScript. I understand how to, but don't know it well enough (if only it was ActionScript). Do you know anywhere I can find some sample scripts of these accordian menus? I tried Googling it but nothing useful really.