Wednesday, 15 April 2015

javascript - Link in JS dropdown menu does not redirect -


So I had to do it all day, but not a good Js Coder is being led me here.

When I click on the link according to "test.html" in the dropdown menu, nothing happens. It does not take anywhere, even if the browser clearly shows that this "test.html" link is active on the hoverway.

Here JS code.

  is up timeout = 500; Win cell = 0; Var ddmenuitem = 0; Ceremony headermenu_open (event) {headermenu_canceltimer (); Headermenu_close (); Var submenu = $ (this) .fund ('ul'); If (submenu) {ddmenuitem = submenu.css ('visibility', 'visible'); return false; } Back true; } Function headermenu_close () {if (ddmenuitem) ddmenuitem.css ( 'visibility', 'hidden');} function headermenu_timer () {closetimer = window.setTimeout (headermenu_close, timed);} function headermenu_canceltimer () {if (closetimer ) {Window.clearTimeout (Collier); closetimer = null;}} bind $ (document) .ready (function () {$ ( '# headermenu Lee') bind ( 'click', headermenu_open) ;. $ ( '# headermenu & gt; Li.) (' Mouseout, Hederman_taimr); $ ( '# Hedermanu & gt; li "). bind (' mouseover ', Hedermankakalteltr);}); Document.onclick = headermenu_close;   

And it's a part of the menu.

  & lt; Ul id = "headermenu" & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Whittalere & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "page / test html" & gt; Test & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt;   

If anyone has the right snippet to add a mistake in the code or I am very happy!

It is due to this line of code

  if ( Submenu) {ddmenuitem = submenu.css ('visibility', 'visible'); return false; }   

This goes to this block and returned

which is e.previted default () and e.stopPropagation () due to which the link does not follow.

Also

if (submenu) / / Return True y value .. because it is an empty jQuery

The object is

There will be a better probe to check the length

  if (subMenu.length)   

Code

  function headermenu_open (event) {event.stopPropagation (); // Prerequisites Need to Prevent Headermenu_canceltimer (); Headermenu_close (); Var submenu = $ (this) .fund ('ul'); If (submenu length) {ddmenuitem = submenu.css ('visibility', 'visible'); return false; } Back true; }   



No comments:

Post a Comment