April 27, 201412 yr I have a problem with links in dropdown menu. If you try to click on the link on dropown the menu will just close without redirecting to a new page. This is the menu I am using http://codepen.io/TimRuby/pen/kLGic Try to replace # in dropdown link with http://google.com or something to see what i mean, the link will only close the menu. Same effect with toggle menu on responsive. What is going on here? TY in advance
April 29, 201412 yr $(hasChild).click(function(e) { //e.preventDefault(); //Remove this dropdown.toggle(); }); Remove the line e.preventDefault(); from the click handler for the dropdown (line 14 in your js) I commented it out in the code as above and it works fine
May 7, 201412 yr I noticed the elements that called the toggle function was li elements so preventDefault was not assigned to the links: Here is a working solution: http://jsfiddle.net/Nillervision/9aXhM/1/ I simply added a className to the link in question <a class="dl" href="#">Features</a> and called the function from the link as well: disabledLink = $('.dl'); /*reference to the a element targeting its classname*/ $(disabledLink, hasChild).click(function(e) { e.preventDefault(); dropdown.toggle(); });
Create an account or sign in to comment