Jquery Accordion Menu not scrolling to anchor tags -
i have jquery accordion menu in footer working great, except fact when submenu opens... page not navigate anchor link. since in footer, forced scroll down see opened submenu. want page automatically scroll down.
any ideas why isn't working? tried putting id within , didn't work.
my html:
<ul class="footer-offices"> <li id="#sanfran" class="one"><a href="#sanfran">text</a> <ul class="submenu"><li>office info here</li></ul> </li> </ul>
jquery is:
$(document).ready(function(){ $("ul.footer-offices li > a").on("click", function(e){ if($(this).parent().has("ul")) { e.preventdefault(); } if(!$(this).hasclass("open")) { // hide open menus , remove other classes $("ul.footer-offices li ul").slideup(350); $("ul.footer-offices li a").removeclass("open"); // open our new menu , add open class $(this).next("ul").slidedown(350); $(this).addclass("open"); } else if($(this).hasclass("open")) { $(this).removeclass("open"); $(this).next("ul").slideup(350); } }); });
it's part:
<li id="#sanfran" class="one">
that id should sanfran
, without #
. #
in <a href="#sanfran"
indicates follows id, #sanfran
redundant.
it should this:
<li id="sanfran" class="one">
everything else looks fine.
Comments
Post a Comment