Results 1 to 4 of 4

Thread: accordion menu and linkable headers (again)

  1. #1
    Join Date
    Feb 2009
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default accordion menu and linkable headers (again)

    1) Script Title: accordion menu bullet

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

    3) Describe problem: I would like to open the related link when clicking an header.

    The result should be:
    - the target page will open
    - the accordion menu on the target page (the accordion menu is saved in a PHP include across all my pages) will open the related header and discover all subheaders.

    It seems you can do something similar using optional 'onopenclose:function', but how can I do this with simple link? the tutorial on the dd page show how to open an IFRAME but I would like to do something simpler: open a link.

    Just in case you're wondering why to do this:
    imagine you have a product catalog with all products orgnized by category and then by subcategory. The first ddaccordion menu will show all categories. When you expand a category you will see all subcategories related to that category. In the same time a new page will open showing the accordion menu (with cklicked category expanded); please note the accordion menu is included on all pages by using a php include funtion. The same page will show all subcategories.
    You click a subcategory in the accordion menu or a subcategory on the page and you are redirected to another page.

    I've read a lot about this problem but I've not found a valid solution yet.

    Any idea?

    Thanks in advance.

    gargiulo

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You don't really need to modify the script much, you may use the method outlined here to get the header links to open their respective pages:

    http://www.dynamicdrive.com/forums/s...55&postcount=9

    To get the menu on the 'receiving' page to open, you may use:

    Code:
    persiststate: true,
    in the ddaccordion.init function, but I believe that will be a little unreliable in some cases. What I would suggest is, to be sure - go ahead and use an include, but use separate ddaccordion.init functions for each page. Set:

    Code:
    persiststate: false,
    except on the home page (unless you want default expanded on it too). Set each 'receiving' page's, ex:

    Code:
    defaultexpanded: [0],
    to the menu you want expanded on it, using the number of the header to expand (numbers start at 0 for the first one). Set all page's:

    Code:
    	collapseprev: true,
    Finally, if relying on persistence to get the home page to display the last 'receiving' page's menu expanded, make this one small modification to the ddaccordion.js file (comment out (red) the two highlighted lines as shown near the end of that file):

    Code:
    			$('.'+config["contentclass"]+":visible").each(function(index){ //get indices of expanded headers
    				expandedindices.push($(this).attr('contentindex'))
    			})
    //			if (config.persiststate==true){ //persist state?
    				expandedindices=(expandedindices.length==0)? '-1c' : expandedindices //No contents expanded, indicate that with dummy '-1c' value?
    				ddaccordion.setCookie(config.headerclass, expandedindices)
    //			}
    		})
    	})
    	}
    }
    - John
    ________________________

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

  3. #3
    Join Date
    Feb 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am having the same issue. I want the menu header bars to link to distinct pages to improve the user experience. Where does this refernced code go? http://www.dynamicdrive.com/forums/s...55&postcount=9
    Last edited by jscheuer1; 02-12-2009 at 12:40 AM. Reason: fix broken link

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by sailorkid View Post
    I am having the same issue. I want the menu header bars to link to distinct pages to improve the user experience. Where does this refernced code go? http://www.dynamicdrive.com/forums/s...55&postcount=9
    In the future, please start a new thread rather than add onto a unresolved or a resolved thread. You may always reference any and all threads that you are referring to by linking to them.

    Anyways, the safest place would be just before your page's closing </body> tag. However, anywhere after the (last) ddaccordion.init script(s) on your page(s).
    - John
    ________________________

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

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
  •