slideUp / slideDown / Filter Issue

slideUp / slideDown / Filter Issue

Hi all,

I've been working on this project for quite a while - and keep having to leave this part of it - only to be stumped every time I come back to it.

I have a nav w/ subnav links. And on the page - I have panels with a header (<h3>) and body (<div>) which is shown/hidden by clicking the respective header.

The subnav links can also show/hide the panel body divs - as well as toggle a class on the header h3s. And this is based on the Text of the subnav link and h3 matching.

Everything works great - aside from the subnav links showing a panel body div. It DOES however add/remove the class on the h3s.

So I'm thinking this has something to do with slideUp/slideDown conflicting somehow with filter?


$(".curNav a").click(function() {

   var openItem = $(this).html();
   
   $("h3").parent().next().next('.panelBody').slideUp(300)
   .filter(function (openItem) {
      $("h3:contains('"+openItem+"')").parent().next().next('.panelBody');
    }).slideDown(300);
   
   $("h3").removeClass("arrow")
   .filter("h3:contains('"+openItem+"')").addClass("arrow");

   return false;
});


Any ideas would be greatly appreciated.

Thanks,
John
    • Topic Participants

    • john