PDA

View Full Version : javascript / ul challenge



Jarago
Jul 19th, 2004, 07:35 PM
I created a script that allows a menu like so:

parent
parent
parent
parent

when one parent is clicked, it opens and goes

parent
parent
child
child
parent
parent

The problem is, when it opens I CANNOT figure out a way to make it slide down open, instead of just opening up. Almost like an effect. The menu created in a jscript file, and the menu itself is a bunch of ul and li tags that work together. I don't know how to apply the effect to the ul and li tags so it'll work. Anyone have done this before?

Thank you

JPM
Jul 19th, 2004, 07:39 PM
Im thinking you would probarly have to run the position of the child elements in a for loop, adding to the style.top propertie each time

Jarago
Jul 19th, 2004, 08:34 PM
How do I go about accomplishing that? You don't have to write the whole code..but maybe a good idea.

JPM
Jul 19th, 2004, 08:47 PM
Well I havent made a real drop down menu before, but I assume you have the child elements positioned absolutely (and the parent relative), so maybe something like this


function rollDown(id) {
for(x=0;x<lengthToScroll;x+=2) {
document.getElementById(id).style.top += x
}

Have no idea if this would work for you. Might not be a very 'smooth' movement.

Jarago
Jul 19th, 2004, 10:19 PM
I tried that, couldn't really get it to work at all for me :(
I'll fool around with it some more, but anyone else have any solutions?

joh6nn
Jul 20th, 2004, 01:41 PM
can you link to the page this is on, so we can get a better idea of what you've already got?

jbot
Jul 20th, 2004, 01:48 PM
think you want to increment the clip area of the submenu, that seems to be how it's typically done.

i'm sure you could find a similar example on www.dynamicdrive.com :D

Jarago
Jul 20th, 2004, 04:13 PM
http://cidap.com/leftmenu/template.html

this is the menu here that I am trying to get to slide if anyone wants to see.
Thank you again,

Cliff