Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Accorrdion Won't Open To Default Tab

Posted on 2014-07-24
5
Medium Priority
?
136 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 2000 total points
ID: 40232126
In ddaccordion.js
look for
var persistedheaders=ddaccordion.getCookie(config.headerclass)

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

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

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

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

722 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