Jump to content

ud2008

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ud2008

  • Rank
    Newbie
  1. Ok, I solved it with the following jquery code: $(document).ready(function(){ $('#topnav ul li ul.submenu li a').click(function(e){ if ($(this).attr('class') != 'active'){ $('#topnav ul li a').removeClass('active'); $(this).addClass('active'); } }); $('a').filter(function(){return this.href === document.location.href; }).addClass('active') $("ul.submenu > li > a").each(function () { var currentURL = document.location.href; var thisURL = $(this).attr("href"); if (currentURL.indexOf(thisURL) != -1) { $(this).parents("ul.submenu").css('display', 'block'); } });
  2. The submenu isn't showing when I load a parent page. I've been playing with a code, but this is still not working: $('#topnav a').each(function(){ var myHref= $(this).attr('href'); if( url.match( myHref)) {$(this).addClass('active');$(this).closest('ul').css('display', 'block'); }}); Can anyone take a look at it?
  3. Ok, first let me explain what I try to do. I have a menu with some items containing a submenu. The submenu's should open when a parent is clicked and contains submenu's, and when traveling to another page (from the item clicked, for example a parent of submenu item), the submenu should remain active and visible. Now when I click on a parent item the submenu quickly blinks but is closed even as fast as it opens. I want the submenu to remain open when clicked on a parent that has a submenu, so users can easily navigate. So, here is the code I have so far: <div id="topnav"> <ul> &
×
×
  • Create New...