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

Thread: keeping menu expanded when opening linked page

  1. #1
    Join Date
    Dec 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Angry keeping menu expanded when opening linked page

    1) Script Title: Accordion Content script (v1.7.1)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...daccordion.htm

    3) Describe problem:
    I have a website (building in Dreamweaver CS4). I am not working with frames so each pages contains the menu.
    When I click on a menu entry the linked page is opened but then the menu entries are collapsed. I think that this comes because the menu is reloaded when loading the new page.
    I need to let the menu stay open so the user can see the next entries in this group and he can see where he is in the menu structure.

    Sorry, my English is not so good.
    What do can I do? Who can help me?

    Best Almute

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    Use either the persistence (persiststate) feature or the defaultexpanded feature, whichever works best for your situation. Both are explained on the demo page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    "persistence" is set to "true".
    I have tested more and found that it works like I need if I start the page new in a browser. The menu stays open in the last stage.
    But if I do some more clicks in the menu and go to other pages then after a some time it doesn't work any more. Then the menu collapses every time a new page is shown.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    Then perhaps try persistence false (don't quote the word false) and try out the defaultexpanded feature. With it you can set which part of the accordion is open on any given page, and it works every time for that page regardless of where that page gets opened.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I don't have quoted the word true for persistence.
    I can't use the defaultexpanded feature because every page uses the same parameters. They are outsourced in a .js file. And the menu is outsourced too in linked files for the script, the css and the menu itself (I will have a lot of pages when all is finished). The menu has nested submenus.
    Is this the reason of my problems?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    Perhaps. Though not the "reason" per se, more like why you cannot easily use defaultexpanded. Only the init part of the code, which is instructed to be placed on the page anyway, ex (from the demo page):

    Code:
    ddaccordion.init({
    	headerclass: "mypets", //Shared CSS class name of headers group
    	contentclass: "thepet", //Shared CSS class name of contents group
    	revealtype: "mouseover", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
    	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
    	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
    	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
    	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
    	animatedefault: false, //Should contents open by default be animated into view?
    	persiststate: false, //persist state of opened contents within browser session?
    	toggleclass: ["", "openpet"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
    	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
    	oninit:function(expandedindices){ //custom code to run when headers have initalized
    		//do nothing
    	},
    	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
    		//do nothing
    	}
    })
    must be unique to each page to allow for a defaultexpanded to be unique to each page.

    Perhaps some helper javascript, and/or even server side code (if you have that available) could be setup to select the defaultexpanded on the basis of the address of the page. That way, the init code could probably remain in one file to be used by all pages.

    So, do you have a server side language available to you? Also, is there a naming convention for the pages that use this script that could be used to easily determine what the number for defaultexpanded would be based upon each page's name? If not, could one be established?

    I could figure most of this stuff (except for what server side language(s), if any are available) out myself if I had a link to the site.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Dec 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    After I have uploaded my new site to a space on the server of my provider I found that many other things that don't work any more. (I tested all on a Mac OS X Server).
    Now I need to check all again.
    The menu still works the first view clicks and than stops working.

    Thank you again for your help

    Almute

  8. #8
    Join Date
    Dec 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi, the website now works – but the menu still stops staying opened after some time.

    Please look at our test version (not all entries are linked) at www.secondsign.de

    Thanks

    Almute

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    To be honest with you, I can't really tell what's going on. Partly it's the language barrier. Although I had a year of it in high school, I don't read German very well, if that's what that is. But the real problem I think is your choice of activating the Accordion with mouseover. The menu reacts in an unintuitive manner, jumping about seemingly uncontrollably. If I click on an item and don't move the mouse away quickly enough or too quickly, there will be consequences once the next page loads. I think you should change it to a click controlled Accordion. That may solve your other problem as well, if not, I'll have another look at it once it is click controlled.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Dec 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I have changed to "click" and deleted the links which are on those entries leading to next level. But the error still occurs: The first clicks it works fine and then after some more clicks it stops working. :-(

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
  •