Results 1 to 4 of 4

Thread: javascript menu defaults to open

  1. #1
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default javascript menu defaults to open

    I am using an accordian style menu on a site that I am helping with and for some reason it defaults to open most of the time. When first open the site the link for services is always open. Can someone take a look at the code and tell me why it defaults to this open state when someone first lands on the page?

    greateropp.com/

    Thank you
    Kevin
    Last edited by krraleigh; 08-25-2009 at 12:29 AM.

  2. #2
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default using jquery accordian menu

    I seem to get quite a few views here.
    Is there some piece of information that I am not including?

    Kevin

    CODE:
    Code:
    <script type="text/javascript" src="javascripts/ddaccordion.js"></script>
    <script type="text/javascript" language="javascript1.3">
    /***********************************************
    * 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
    ***********************************************/
    ddaccordion.init({
    	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
    	contentclass: "categoryitems", //Shared CSS class name of contents group
    	revealtype: "click", //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: 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: "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>

  3. #3
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    so you want to hide the slide on the first open:
    Code:
    defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
    change it into

    Code:
    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
    remove the 0 value,
    If you use the second code, when user open the page no accordion effect will show until they click it.
    sorry if i miss some point of your question..
    good luck

  4. #4
    Join Date
    Jun 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I appreciate the help
    works great!

    thanx Kevin

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
  •