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

Thread: To make the accordion menu always open ))

  1. #1
    Join Date
    Nov 2014
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default To make the accordion menu always open ))

    I use old ddaccordion. Script - ddaccordion, link - http://www.dynamicdrive.com/dynamici...daccordion.htm
    Tried all settings. But to make the default is ALWAYS open items i could not.
    HTML Code:
    ddaccordion.init({
    	headerclass: "submenuheader", //Shared CSS class name of headers group
    	contentclass: "submenu", //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: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    	onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
    	animatedefault: true, //Should contents open by default be animated into view?
    	persiststate: true, //persist state of opened contents within browser session?
    	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    	togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"], //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(headers, 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
    	}
    })
    Last edited by mrtdiesel; 11-12-2014 at 02:26 PM. Reason: ddadmin

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

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question, in this case, http://www.dynamicdrive.com/dynamici...daccordion.htm

    You should also set the options persiststate and collapseprev if you wish all headers to be open by default when the page loads in all circumstances:

    Code:
    ddaccordion.init({
    	headerclass: "submenuheader", //Shared CSS class name of headers group
    	contentclass: "submenu", //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: false, //Collapse previous content (so only one open at any time)? true/false 
    	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    	onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
    	animatedefault: true, //Should contents open by default be animated into view?
    	persiststate: false, //persist state of opened contents within browser session?
    	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    	togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"], //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(headers, 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
    	}
    })
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    mrtdiesel (11-12-2014)

  4. #3
    Join Date
    Nov 2014
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    DD Admin thank you. But options "persiststate" and "collapseprev" do not open the menu when you first visit the site. They are only open items after user actions and not hide the menu after navigating to other pages. It is necessary that the menu items were open always. Maybe it's easy to do. But not using the current settings. But I don't know Java script. Sorry for my English.

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

    Default

    Ah yes you're right. Well, in that case, you can make sure of the defaultexpanded option to specify the contents to be open, in this case, all of them:

    Code:
    ddaccordion.init({
    	headerclass: "submenuheader", //Shared CSS class name of headers group
    	contentclass: "submenu", //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: false, //Collapse previous content (so only one open at any time)? true/false 
    	defaultexpanded: [0,1,2,3], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    	onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
    	animatedefault: true, //Should contents open by default be animated into view?
    	persiststate: false, //persist state of opened contents within browser session?
    	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    	togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"], //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(headers, 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
    	}
    })
    If you don't know the exact number of accordion contents in advanced, you can also call instead:

    Code:
    ddaccordion.expandall('header_class')
    to expand all of the accordion contents. See this page: http://www.dynamicdrive.com/dynamici...suppliment.htm The above method should be called after the Accordion has been initialized though. If you need help with this, let me know.
    DD Admin

  6. #5
    Join Date
    Nov 2014
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    defaultexpanded [0,1,2,3] - does not work. But I did like this [index1, index2...]. This scheme works. But exactly the opposite - always closed headers menu. Sub menu items are not visible. Maybe can specify the option so that it "does not equal" (as in PHP - defaultexpanded "! =" [index1, index2...])?

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

    Default

    Hmm it should have worked. Do you have a URL to the problem page with the changes suggested so far implemented that we can check out?
    DD Admin

  8. #7
    Join Date
    Nov 2014
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Ok. all pages except the main /index.html have these settings - defaultexpanded: [index0,index1,index2,index4]. For example http://rods.ru/rods/index.php?page=egypt
    index.html have these settings - defaultexpanded: [].

    The complete code for http://rods.ru/rods/index.php?page=egypt :
    Code:
    <script type="text/javascript" src="js/ddaccordion.js">
    /***********************************************
    * Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/
    </script>
    <script type="text/javascript">
    ddaccordion.init({
    	headerclass: "submenuheader", //Shared CSS class name of headers group
    	contentclass: "submenu", //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: [index0,index1,index2,index4], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    	onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)
    	animatedefault: true, //Should contents open by default be animated into view?
    	persiststate: true, //persist state of opened contents within browser session?
    	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
    	togglehtml: ["suffix", "<img src='plus.gif' class='statusicon' />", "<img src='minus.gif' class='statusicon' />"], //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(headers, 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
    	}
    })
    </script>

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

    Default

    You currently have:

    Code:
    defaultexpanded: [index0,index1,index2,index4], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    which is incorrect. The indices need to be specified as integers, so:

    Code:
    defaultexpanded: [0,1,2,3], //index of content(s) open by default [index1, index2, etc] [] denotes no content
    DD Admin

  10. #9
    Join Date
    Nov 2014
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    As I said, I already did [0,1,2,3,4] but it absolutely does not work (does not react).
    And with the current form [index0,index1,index2] at least something is happening, but on the contrary!))
    Look, now I've done this: [0,1,2,3,4]

  11. #10
    Join Date
    Nov 2014
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Can the option "defaultexpanded" conflicts with other options?

Similar Threads

  1. Get Accordion Menu to stay open...
    By anamaniac in forum JavaScript
    Replies: 0
    Last Post: 06-14-2011, 12:14 AM
  2. HOw can I make the popit menu open a new window
    By ryancmartin in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 05-24-2011, 11:47 PM
  3. Resolved Flex Level Drop Down Menu - make sub menu open to the left
    By michael_zz in forum Dynamic Drive scripts help
    Replies: 6
    Last Post: 02-18-2010, 05:51 PM
  4. Accordion Menu: Passing A Parameter To Open A Menu Header (not in the url)
    By olee1kenobi in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 05-03-2008, 01:44 AM
  5. HV Menu - need to make it open a new window
    By dbxwanderer in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-17-2004, 11:49 AM

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
  •