<ul id="mega-1" class="first_level mega-menu"> <li class="item_menu"><a href="/rus/" class="f_level_link">111111</a> <ul class="second_level"> <li class="sub_item_menu"><a href="/rus/new/">2222</a></li> <li class="sub_item_menu"><a href="/rus/new/">2222</a></li> </ul> </li> <li class="item_menu"><a href="/rus/" class="f_level_link">111111</a> <ul class="second_level" > <li class="sub_item_menu"><a href="/rus/new/">2222</a></li> <li class="sub_item_menu"><a href="/rus/new/">2222</a></li> </ul> </li> <li class="item_menu"><a href="/rus/" class="f_level_link">33333</a></li> </ul>​ 

How to block links in the menu (111111), where is the submenu (2222)? And in the menu (333), a transition should be made. There is a submenu popup pops up on the hover on juery. tried through false then the links then work as they should (do not go to another page) but the hover effect does not work anymore. What are the options?

  • I understand that this is a continuation of the previous question . Sorry you deleted the option on jsFiddle. Because of this, and my answer "floated away." Once again lay out primerchik there? try to solve the puzzle. - Deonis

2 answers 2

 $('.mega-menu li').each(function(){ if($(this).find('ul').length){ $(this).find('a').eq(0).click(function(){ return false; }); } }); 
     onclick="return false;" 
    • In this case, all links are blocked, but I need only those that have a submenu - Hancock888
    • Look toward stopPropagation () and stopImmediatePropagation () - Deonis
    • @ Hancock_888, use for those links where there is a submenu. Or do you generate them dynamically? - stck
    • Yes, through the template. (dynamic loading) - Hancock888
    • In a template, in any case, form the type of link - add to the elements that are categories this attribute. And that's it :) - stck