Page 3 of 8 FirstFirst 12345 ... LastLast
Results 21 to 30 of 75

Thread: [DHTML] Slashdot's Menu

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

    Default

    This is a great script! Thanks.

    The expand/contract buttons are very helpful, but the default contract doesn't seem to work for me.

    Code:
    var contractall_default = true;
    Still, it defaults to expanded.

    Any thoughts?

    Thanks.

  2. #22
    Join Date
    Aug 2004
    Posts
    9,876
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Do you have persistence enabled as well directly above that line? If so the persistence takes precedence over the contract all feature. To confirm this, turn persistence off.

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

    Default

    Do you have persistence enabled as well directly above that line? If so the persistence takes precedence over the contract all feature. To confirm this, turn persistence off.
    Actually it seems to me that to turn persistence off goes against the idea of wanting the menu to follow the user.

    How about this...

    Code:
    function restore() {
        if(getcookie("menu") != null) {
            var hidden = getcookie("menu").split(",");
            for(var i in hidden) {
                titles[hidden[i]].className = "titlehidden";
                submenus[hidden[i]].style.height = "0px";
                submenus[hidden[i]].style.display = "none";
                arrows[hidden[i]].src = "media/collapsed.gif";
            }
        }
    	else if (contractall_default) //DD added code
    			slash_contractall() //DD added code
    }
    Put the slash_contractall into the restore function. That way if the Menu cookie is null, it contracts the menu. If the Menu cookie is not null, it leaves persistance as it is.

    Thoughts? This seems to work for me.

  4. #24
    Join Date
    Aug 2004
    Posts
    9,876
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Put the slash_contractall into the restore function. That way if the Menu cookie is null, it contracts the menu. If the Menu cookie is not null, it leaves persistance as it is.

    Thoughts? This seems to work for me.
    It's really a matter of preference and how you define "persistence". If the menu cookie is null, it actually means the user has chosen to have all menu items expanded. The persistence feature as is honors this, and the next time the page loads, all menu items are expanded.

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

    Default

    This script is perfect, except for one minor flaw in my case. I'm trying to use it on multiple pages. Unfortunately, instead of looking for the cookie and replacing / updating it... it creates a new cookie every time you navigate to a new page with the navigation on it. Anyone have any ideas?

  6. #26
    Join Date
    Aug 2004
    Posts
    9,876
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    To make the persistence/ cookie site wide, find the line:

    Code:
    document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires="+exdate);
    inside menu.js, and change that to:

    Code:
    document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";path=/; expires="+exdate);

  7. #27
    Join Date
    Jul 2006
    Location
    Cowling, Yorkshire
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Contract previous menu item

    dmurray14 asked for 2 improvements to slashdot - No1 is sorted great - but is any of you great minds working on No2 (contracting the previous menu item whenever a new menu item is opened?
    I look forward to a new updated slashdot menu
    Cheers

    Quote Originally Posted by dmurray14
    Thanks for the nav bar, I love it. However I do have two requests, if I may...

    1) is it possible to make it so all the menu items are closed on page load?

    2) Possible to have other open menu items close when another is selected? Ie, I select menu item one, it expands. I select menu item 2, and it expands and closes menu item one.

    Thanks a lot, much appreciated!

    Dan

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

    Default

    Does anyone know what would cause this error?

    "titles[hidden[i]] has no properties"
    "Line 61 in menu.js"

    From firefox.

    Is it conflicting with another script on my site?

    Basically, everything on the page loads, but the engines are still churning. The slashdot nav is un-usable for about 30 seconds, at which time the browser stops churning and the menu becomes expandable / contractable. Then the error above is goes into the javascript console log as an error.


    Does the same thing in IE, but I've heard firefox errors are better.
    Last edited by mgisonno; 08-01-2006 at 05:44 AM.

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

    Default Trouble with conflicting Scripts

    Hey all, i love the slashdot menu, unfortunately I seem to be having trouble with conflicting scripts. What i want to do is include a line of code in the body tag loading that will load both scripts at the same time.

    Example:

    SCRIPT 1: window.onload=dothis
    SCRIPT 2: window.onload=dothat
    RESOLUTION: <body onload="dothis();dothat()">

    What ive come up with so far

    <body onload="function(){enableTooltips("Content"); <---Need to know what to pull from the slashdot menu.js to put here --->">

    Thanks for your help
    Paul

  10. #30
    Join Date
    Aug 2004
    Posts
    9,876
    Thanks
    3
    Thanked 962 Times in 951 Posts
    Blog Entries
    15

    Default

    Mitchepa:
    Simply remove the line:

    Code:
    window.onload = init;
    from menu.js, and add it to your BODY like so:

    Code:
    <body onload="enableTooltips('Content'); init()" >

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
  •