Results 1 to 6 of 6

Thread: Accordion Modifications

  1. #1
    Join Date
    Feb 2008
    Location
    Philadelphia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Accordion Modifications

    1) Script Title: Accordion Menu

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

    3) Describe problem:

    What I need to do is make the browser forget your menu selection when you navigate away from the page, not just when you close the browser. It's a bit odd to navigate away from a page and come back to it half an hour with the last menu you selected displaying.
    Last edited by alwaysintense; 02-07-2008 at 05:31 PM.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    If I understand you right, this should do it:

    Code:
    <script type="text/javascript">
    
    
    ddaccordion.init({
    	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
    	contentclass: "categoryitems", //Shared CSS class name of contents group
    	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
    	animatedefault: false, //Should contents open by default be animated into view?
    	persiststate: true, //persist state of opened contents within browser session?
    	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
    	animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
    })
    
    
    </script>
    Simply set the highlighted part in the above code to false and that should take care of it.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Feb 2008
    Location
    Philadelphia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I tried this initially, but that makes it so after each click of a category item, the menus reset.

    From what I understand, their are cookies assigned so that the browser remembers which menu was last opened and keeps it open in a given session.

    I want it to remember this only when the site is active in the browser. Meaning, I want the last selected menu to be persistent, but I need it to "reset" once the user navigates away from the page. not just for a browser session. So when they come back, the last menu selected doesn't display. As it is now, this only happens when the browser is closed.

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

    Default

    I'm not sure I understand. What you said:

    Meaning, I want the last selected menu to be persistent, but I need it to "reset" once the user navigates away from the page.
    Why would the state of the headers reset if you have yet to navigate away from the current page, regardless of whether persistence is on or off?

  5. #5
    Join Date
    Feb 2008
    Location
    Philadelphia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sorry, I'm really bad at making myself clear unless I'm on the phone or face-to-face with someone.

    What I mean is that with the persistence on, it works the way I want it to until I decide to navigate away from the page.

    If I am the end-user, and I browse to a site that is utilizing this script, and I choose "Category 1" and reveal its category items, "Category 1" stays "open". Now I have browsed away from the site. Two hours later, I go back to the site and "Category 1" is still "open".

    I want it to be closed in this kind of situation, but I want persistence to be on as long as I am viewing the site. Currently, it does what I want only if I exit my browser and re-open it. Is there a way to program this so that it "forgets" that I opened a category list if I navigate away from the site?

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

    Default

    I see. So to rephrase, you're asking if the current persistence feature can be limited so it expires as soon as the user leaves the site itself, rather than close the browser window altogether. Off the top of my head, I don't see any easy way to do this unfortunately. The concept behind it is similar to how "Site exist popup ads" that was once popular operated, in that a pop up ads only pops up when the user leaves the site in question, not just a particular page within the site. I've not really researched into how that's accomplished though.

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
  •