Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Slashdot menu script question

  1. #1
    Join Date
    Jul 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Slashdot menu script question

    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
    Last edited by iced; 07-07-2006 at 03:27 PM.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Even with the new template, we get questions like this?
    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    I haven't tested this out thoroughly yet, but try the below:

    Add the below function inside menu.js:

    Code:
    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:

    Code:
    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.

  4. #4
    Join Date
    Jul 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin
    I haven't tested this out thoroughly yet, but try the below:

    Add the below function inside menu.js:

    Code:
    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:

    Code:
    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

  5. #5
    Join Date
    Jul 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    How to Expand/Collapse all menu add/edit.

  6. #6
    Join Date
    Jul 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by ddadmin
    I haven't tested this out thoroughly yet, but try the below:

    Add the below function inside menu.js:

    Code:
    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:

    Code:
    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!

  7. #7
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    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.

  8. #8
    Join Date
    Jul 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Maybe safari support could be added?

    This somewhat similar menu works across the browsers:

    http://www.dynamicdrive.com/dynamici...witchmenu2.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.

  9. #9
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    What's the error in Safari? Since I don't have access to a Mac right now, I can only run a screenshot of how a script looks in Safari.

  10. #10
    Join Date
    Jul 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It does not collapse the menu. Strangely, it will open the menus if you set the intial state to collapsed using your mod.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •