0

I have a standard accordion. It works very nicely, opening and closing, but clicking on the individual links doesn't take me to the desired page, but just opens and closes the accordion, which makes sense. So how to make the links function as well?

<ul class="trackAccordion">
  <li><a href="citiesOverviewPage">Cities</a>                           
    <ul class="trackAccordion">
      <li><a href="denver">Denver</a>                           
         <ul class="trackAccordion">
           <li><a href="denver/classes">Classes</a></li>
           <li><a href="denver/events">Events</a></li>
           <li><a href="denver/about">About</a></li>
         </ul>
      </li>
      <li><a href="newyork">New York</a>                            
        <ul class="trackAccordion">
           <li><a href="newyork/classes">Classes</a></li>
           <li><a href="newyork/events">Events</a></li>
           <li><a href="newyork/about">About</a></li>
         </ul>
      </li>
    </ul>
  </li>
  <li><a href="about">About</a></li>
</ul>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
    $( document ).ready(function() {
  $("ul.trackAccordion").accordion({
    collapsible: true,
    active: false,
    heightStyle: "content"
  });
});
/*]]>*/
</script>

EDIT: Here is a jSFiddle which is cut directly from the page. On my webpage, if I don't include the js for the accordion, the links work (though maybe a couple 404s because the website isn't finished): https://jsfiddle.net/3j4r1m4o/1/

kr37
  • 1,661
  • 1
  • 11
  • 7
  • Could you make a fiddle demonstrating the issue? Also, maybe work with valid href values? – jmargolisvt Jun 20 '15 at 16:36
  • @jmargolisvt Done. The fiddle has actual urls. – kr37 Jun 20 '15 at 17:13
  • The click can only do one thing: it's either going to go with the default behavior of the anchor or, it's going to go with the event you attach to it. http://stackoverflow.com/questions/588030/link-to-open-jquery-accordion – jmargolisvt Jun 20 '15 at 18:56
  • That makes sense, thank you for nailing that down. I've been looking at what other options there are. – kr37 Jun 23 '15 at 03:51

0 Answers0