By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,738 Members | 1,730 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,738 IT Pros & Developers. It's quick & easy.

Cascading Menu scripts

P: n/a
I am looking for a simple cascading menu javascript.One where it lives on
the left side of the screen, listed vertically and when you select a menu
item the list expands to show the sub menu items within that catagory.

This is the only decent one I've been able to find.
http://www.bravenet.com/resources/sc...d=92&cat_name=

If you check out the demo you'll notice it's very slow. It has a speed
variable but it only seems to make it slower.

Another example of close to what I'm trying to accomplish (my first
inspiration):
http://www.ataonline.com/about/media/index.asp

If anyone knows how to speed up the first one, or knows of another SIMPLE
expanding cascading script please let me know. I'm trying to make this as
cross browser as possible as well. I know it's a lot to ask on a no budget
project, but thought I'd ask anyways.

Thanks,

Steven LaPha Jr.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"gregory stevenson" <gr********@hotmail.com> writes:
This is the only decent one I've been able to find.
http://www.bravenet.com/resources/sc...d=92&cat_name=
I would be worried using it. I can see a few bad methods used, e.g.,
setting the obj.style.top without a unit, which *will* fail in most
browsers in standards mode.
If you check out the demo you'll notice it's very slow. It has a speed
variable but it only seems to make it slower.
Yes
If anyone knows how to speed up the first one, or knows of another SIMPLE
expanding cascading script please let me know.


The speed is used as the second argument of the setTimeout, and
defaults to 0, so that's as fast as it gets.

What you can do, is to change by how many pixles it moves per timeout.
I.e., the line
obj.style.top = parseInt(obj.style.top)-1;
can be changed to
obj.style.top = Math.max(parseInt(obj.style.top,10)-5,0) + "px";
A line furter down reads
nowv--;
Change that to
nowv-=5;
and it moves five times as fast when it closes. There is probably an equivalent
code for moving down.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
Ok here's what I got,
Only problem is now the menu boxes overlap when compressed, and have an
extra space when expanded. Not too big of a problem, but probably solvable.
It IS faster though, much more managable.
Now that many have high speed networks, and faster computers who wants to
wait for a slow menu that acts as if it's on a 486?

------------------------clipped script------------------------
function epull_down(nr,to,nowv)
{
name = "down" + (nr-1);
obj = document.getElementById(name).style.clip =
"rect(0,"+width+","+(+nowv+1)+",0)";
for (i=nr;i<self_menu.length;i++)
{
name = "down" + i;
obj = document.getElementById(name);
obj.style.top =Math.max(parseInt(obj.style.top,10)+5,0)+"px";
}
nowv+=5;
if(nowv < to) timerID =
setTimeout("epull_down("+nr+","+to+","+nowv+")",sp eed);
else timerID = "";
}

function epull_up(nr,to,nowv)
{
name = "down" + (nr-1);
obj = document.getElementById(name).style.clip =
"rect(0,"+width+","+nowv+",0)";
for (i=nr;i<self_menu.length;i++)
{
name = "down" + i;
obj = document.getElementById(name);
obj.style.top = Math.max(parseInt(obj.style.top,10)-5,0)+"px";
}
nowv-=5;
if(nowv > to) timerID =
setTimeout("epull_up("+nr+","+to+","+nowv+")",spee d);
else timerID = "";
-------------------------end cliped script---------------

"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:8y**********@hotpop.com...
"gregory stevenson" <gr********@hotmail.com> writes:
This is the only decent one I've been able to find.
http://www.bravenet.com/resources/sc...d=92&cat_name=

I would be worried using it. I can see a few bad methods used, e.g.,
setting the obj.style.top without a unit, which *will* fail in most
browsers in standards mode.
If you check out the demo you'll notice it's very slow. It has a speed
variable but it only seems to make it slower.
Yes
If anyone knows how to speed up the first one, or knows of another

SIMPLE expanding cascading script please let me know.


The speed is used as the second argument of the setTimeout, and
defaults to 0, so that's as fast as it gets.

What you can do, is to change by how many pixles it moves per timeout.
I.e., the line
obj.style.top = parseInt(obj.style.top)-1;
can be changed to
obj.style.top = Math.max(parseInt(obj.style.top,10)-5,0) + "px";
A line furter down reads
nowv--;
Change that to
nowv-=5;
and it moves five times as fast when it closes. There is probably an

equivalent code for moving down.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html> 'Faith without judgement merely degrades the spirit divine.'

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.