jQuery Mobile Drop Down Menu Causing Page Reload

送分小仙女□ 提交于 2019-12-25 03:59:14

问题


I have a drop down menu on this development Wordpress site: http://zap2dev.redzephyr.biz/ the mobile menu appears to be working fine however upon pressing the mobile menu icon the menu displays and promptly the page begins reloading. Obviously on reload the mobile menu is collapsed again so begins the vicious cycle.

Any ideas what could be causing the page to reload?

Any help would be greatly appreciated.


回答1:


Change <a class="navicon mtoggle" href=""> to <div class="navicon mtoggle"> then update your css

nav#mobile .navicon{
cursor:pointer;
}



回答2:


Try making your toggle not a link and instead a div. Otherwise with javascript assign on click or touch to prevent.default which would cause the browser from trying to open the link which doesn't have an assigned href and reloads the page.



来源:https://stackoverflow.com/questions/23481971/jquery-mobile-drop-down-menu-causing-page-reload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!