Solved

Accorrdion Won't Open To Default Tab

Posted on 2014-07-24
5
132 Views
Last Modified: 2014-08-01
Hi, using this accordion: the goal is to get the first item to be the default, so when someone is on the 3rd header, then hit refresh, the first one will be default.

Not sure what I'm doing wrong

http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-bullet.htm?expandable=3

defaultexpanded: [0]

   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: true, //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
	  }
  })

 <h3 class="menuheader expandable">Blah</h3>
                                    <ul class="categoryitems">
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                    </ul>
                                <h3 class="menuheader expandable">Blah</h3>
                                    <ul class="categoryitems">
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                    </ul>
                                <h3 class="menuheader expandable">Blah</h3>
                                    <ul class="categoryitems">
                                        <li><a href="http://www.google.com" target="_blank">Blah</a></li>
                                    </ul>
                                  <h3 class="menuheader expandable">Blah</h3>
                                    <ul class="categoryitems" id="last-ui" style="">
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                        <li><a href="http://www.google.com/">Blah</a></li>
                                    </ul>

Open in new window

0
Comment
Question by:Computer Guy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40217238
And what is it doing now?
The menu will always default to the deafult value unless you are manually changing the url like they do on DD with a link.
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 40217259
If I am on line 87 of my code (3rd section), and hit refresh, it stays on line 87 instead of going back to the 1st section.
0
 
LVL 58

Expert Comment

by:Gary
ID: 40217272
Post a link to the page or post your whole code - line 87 means nothing to me
0
 
LVL 3

Author Comment

by:Computer Guy
ID: 40231870
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40232126
In ddaccordion.js
look for
var persistedheaders=ddaccordion.getCookie(config.headerclass)

After this line add
persistedheaders="0c";
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question