Issue with jQuery Menu Links

I'm trying to implement this jQuery Menu that I found on the Internet: http://spyrestudios.com/coding-a-horizontal-navigation-bar-with-jquery-dropdown-menus/

For some reason this doesn't allow links to URL's.

http://www.virtualpetstore.com/

I've tried to remove e.preventDefault from the script but that doesn't work either.

http://jsfiddle.net/NinjaSk8ter/4m7Q2/3/

$(document).ready(function(){
   $('a').on('click', function(e){
    e.preventDefault();
   });

$('#ddmenu li').hover(function () {
 clearTimeout($.data(this,'timer'));
 $('ul',this).stop(true,true).slideDown(200);
}, function () {
$.data(this,'timer', setTimeout($.proxy(function() {
  $('ul',this).stop(true,true).slideUp(200);
}, this), 100));
});

});

I was wondering if anyone has a clue about what the problem is?

Answers


Try

$('li:has(ul) > a').on('click', function (e) {
    e.preventDefault();
});

You need to set the target of the link to '_blank', and probably remove the e.preventDefault(). For example:

<a target="_blank" href="http://www.google.com">Our Mission</a>

New fiddle here: http://jsfiddle.net/4m7Q2/4/


I loaded your page and ran this in the console and then the links worked fine.

$('a').unbind('click');

It seems that the preventDefault is definitely what's eating your links.


Need Your Help

cocos2d-x screen flicker on Android

android c++ cocos2d-x

I got screen flicker when developing with cocos2d-x 3.0alpha1.

How to ignore/prevent javadoc folder from validation during Eclipse Build?

eclipse build

In my war is a huge javadoc folder. There is no point in validating it since javadocs are produced by Sun(Oracle) javadoc utility. I have forgotten how I did it the last time. I need to tell Eclipse