PDA

View Full Version : Slashdot menu script question



iced
07-07-2006, 03:09 PM
Script: DD Slashdot Menu

Script URL: http://www.dynamicdrive.com/dynamicindex1/slashdot.htm

The Problem:

Where to change the code in the slashdot menu script to make the menu start collapsed instead of expanded at the start/first visit?
I can't find where to change this. thanks

Twey
07-07-2006, 03:10 PM
Even with the new template, we get questions like this?
もうばか…

ddadmin
07-08-2006, 12:08 AM
I haven't tested this out thoroughly yet, but try the below:

Add the below function inside menu.js:


function collapseit(){
if(getcookie("menu") == null){
for (var i=0; i< arguments.length; i++) {
titles[arguments[i]].className = "titlehidden";
submenus[arguments[i]].style.height = "0px";
submenus[arguments[i]].style.display = "none";
arrows[arguments[i]].src = "slashfiles/collapsed.gif";
}
}
}

Then, find the line:


if(remember) restore();
collapseit(0,1)

and add to that the code in red above. 0, 1 tells the script to auto hide the first and second menu sections. 0,1,2 would mean all 3 sections, 0 just the first section etc.

dmurray14
07-08-2006, 06:54 AM
I haven't tested this out thoroughly yet, but try the below:

Add the below function inside menu.js:


function collapseit(){
if(getcookie("menu") == null){
for (var i=0; i< arguments.length; i++) {
titles[arguments[i]].className = "titlehidden";
submenus[arguments[i]].style.height = "0px";
submenus[arguments[i]].style.display = "none";
arrows[arguments[i]].src = "slashfiles/collapsed.gif";
}
}
}

Then, find the line:


if(remember) restore();
collapseit(0,1)

and add to that the code in red above. 0, 1 tells the script to auto hide the first and second menu sections. 0,1,2 would mean all 3 sections, 0 just the first section etc.


Awesome, thanks...I'll give it a try!

Dan

NSOrg
07-09-2006, 12:41 PM
How to Expand/Collapse all menu add/edit.

dmurray14
07-10-2006, 02:29 PM
I haven't tested this out thoroughly yet, but try the below:

Add the below function inside menu.js:


function collapseit(){
if(getcookie("menu") == null){
for (var i=0; i< arguments.length; i++) {
titles[arguments[i]].className = "titlehidden";
submenus[arguments[i]].style.height = "0px";
submenus[arguments[i]].style.display = "none";
arrows[arguments[i]].src = "slashfiles/collapsed.gif";
}
}
}

Then, find the line:


if(remember) restore();
collapseit(0,1)

and add to that the code in red above. 0, 1 tells the script to auto hide the first and second menu sections. 0,1,2 would mean all 3 sections, 0 just the first section etc.

Gave it a try and it didn't work for some reason. They all stay open. Any ideas?

Thanks again for your help.

Dan

Edit: maybe I should be a little more clear on the behavior I'm looking for. When the page loads for the first time, all menus should be collapsed. Every time a sub menu is clicked on and expanded, I'd like any other open submenus to close. I don't want more than one menu open at the same time. I'd like it to continue to remember which menu is open throughout pages, but again, I only want one open at a time. This possible?

Thanks again!

ddadmin
07-10-2006, 06:39 PM
Ah dmurray14, I didn't know you also wanted the previous menu section to contract when another section is expanded. The code I posted above only lets you specify certain sections to be initially contracted.

There are quite a few suggestions along the same line coming in for this script, so I'd like to address them all in one shot, the next time the script is updated. For now I think your closest bet for such a script behavior is via Switch Content script (http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm).

immts
07-11-2006, 10:04 PM
Maybe safari support could be added?

This somewhat similar menu works across the browsers:

http://www.dynamicdrive.com/dynamicindex1/switchmenu2.htm

As does the real slashdot menu. If I didn't need to worry about Safari users I wouldn't give a rip.

But this is an incredibly nice little menu package.

ddadmin
07-12-2006, 09:19 AM
What's the error in Safari? Since I don't have access to a Mac right now, I can only run a screenshot (http://snugtech.com/) of how a script looks in Safari.

immts
07-12-2006, 06:41 PM
It does not collapse the menu. Strangely, it will open the menus if you set the intial state to collapsed using your mod.

ddadmin
07-13-2006, 01:18 AM
Ok, add that to the things I'll look at addressing the next time the script is updated.