Links not working?

This might seem like a really daft question but I’m stuck. I’ve got a menu bar that has a series of links on it. They all have valid links and if I right click to open any of them in a new window they do, but if I just click them then nothing happens at all.

The menu bar is:

<div id="fullmenu">
     <div class="wrapper">
      <div id="menuclose-1" class="menuclose">
       <a id="dd-1" class="dd" href="#">Products</a>
       <div id="menudrop-1" class="menudrop" style="">
        <div class="wrapper">
         <div class="indent">
                   <div class="dropcolumn">
<h3><a href="#">Main Link 1</a></h3>
<p><a href="#">Sub Link 1</a></p>
<p><a href="#">Sub Link 2</a></p>
          </div>
          <div class="dropcolumn">
                   </div>
          <div class="clr">&nbsp;</div>         </div>
        </div>
       </div>
      </div>
      <div id="menuclose-2" class="menuclose">
       <a id="dd-2" class="dd" href="#">Information</a>
       <div id="menudrop-2" class="menudrop" style="">
        <div class="wrapper">
         <div class="indent">
                        <div class="dropcolumn">
           <h3><a href="#">Main Link 1</a><a href="#"></a></h3>
           <p><a href="#">Sub Link 1</a><a href="#"></a></p>
          </div>
          <div class="dropcolumn">
                     </div></div>
        </div>
       </div>
      </div>
      <div id="menuclose-3" class="menuclose">
       <a id="dd-3" class="dd" href="#">Customer Services</a>
       <div id="menudrop-3" class="menudrop" style="">
        <div class="wrapper">
         <div class="indent">
                        <div class="dropcolumn">
           <h3><a href="#">Contact</a></h3>
           <p><a href="#">Email</a><a href="#"></a></p>
           <p><a href="#">Address</a><a href="#"></a></p>
          </div>
                        <div class="dropcolumn">
           <h3><a href="#">Orders</a></h3>
           <p><a href="#">Delivery</a><a href="#"></a></p>
           <p><a href="#">FAQ</a><a href="#"></a></p>
          </div>
                        <div class="dropcolumn">
                        </div></div>
        </div>
       </div>
      </div>
      <div id="menuclose-4" class="menuclose">
       <a href="#">Special Offers</a>
      </div>
      <div id="menuclose-5" class="menuclose">
       <a href="#">Blog</a>
      </div>
     </div>
    </div>

and the JavaScript that controls it is:

$(".menuclose").hover( function(){
    if( htimer ) { clearTimeout( htimer ); htimer=null; }
    var id=$(this).attr("id").replace( "menuclose-","" );
    if( mcur!=id ) { htimer=setTimeout( function(){ menuact( id ); },100 ); }
  },function(){
    if( htimer ) { clearTimeout( htimer ); htimer=null; }
    htimer=setTimeout( function(){ menuact( null ); },300 );
  });

  $(".menuclose").click( function(){
    if( !$(this).hasClass( "menudrop" ) ) {
      var id=$(this).attr("id").replace( "menuclose-","" );
      if( mcur!=id ) { menuact( id ); }
      return false;
    }
  });

  $("body:not(.menuclose)").click( function(){
    menuact( null );
  });

  function menuact( id ) {
    var anspeed=300;
    if( id!=mcur ) {
      if( id ) {
        $(".menuclose").removeClass( "menuactive" );
        $("#menuclose-"+id).addClass( "menuactive" );
        if( mcur ) {
          $("#menudrop-"+mcur).hide();
          $("#menudrop-"+id).show();
        } else {
          $("#menudrop-"+id).slideDown(anspeed);
        }
      } else {
        $(".menudrop").slideUp(anspeed,function(){
          $(".menuclose").removeClass( "menuactive" );
        });
      }
      mcur=id;
    }
  }

I’d be grateful for any help please

If you remove the above, does the menu open on click?

I’m sorry I thought I’d replied to this weeks ago but when I just checked it I realised I hadn’t. Unfortunately I tried that and it still didn’t work :disappointed:

Here’s where the problem is occurring.

  $(".menuclose").click( function(){
    if( !$(this).hasClass( "menudrop" ) ) {
      var id=$(this).attr("id").replace( "menuclose-","" );
      if( mcur!=id ) { menuact( id ); }
      return false;
    }
  });

When a menu item is clicked, that above event handler steps in and returns false, preventing the default action (that of following the link) from taking place.

The question is, did you write this, and under what situations do you want the link to not be followed?

No I didn’t write it and to be honest am not sure why they wrote it like that. I’ve changed false to true and it now works thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.