views:

233

answers:

1

hi, i use the followig accordion menu:

function initMenu() {
  $('#submenu ul').hide();
  //$('#submenu ul:first').show();
  $('#submenu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#submenu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
$(document).ready(function() { initMenu(); });

now, when a link in the #submenu list gets active, the accordion closes and i have to open it up again when chooseing another link from the #submenu. my question: how can i tell this script, that when a li in the #submenu list has the class .active_link, the accordion opens automatically that current ul #submenu list?

the .active_link class is only set, when the link is active!

you understand my question? :)

thanks and regards!

A: 

Try triggering a click on it when the dom is ready:

$('#submenu li a.active_link').click();
Alex Sexton