brewern / mobile-menu

77 stars 35 forks source link

Double menu. #8

Open pafnuty opened 10 years ago

pafnuty commented 10 years ago

Hello! Thanks for the great plugin, it is the only one that suited my needs. But in the process of using one revealed a bug: If I move script to the end of the page - is a duplication of the menu. demo: https://github.com/pafnuty/mobile-menu/blob/master/demo/index.html

MikyKuroneko commented 10 years ago

Same here. After looking carefully at what happens I saw that the domready event is fired twice when mobile-menu is used. I have the JS files at the bottom too.

EDIT: A quick fix: check if $("#build-menu") or $("#build-menu-page") exist right after your domready event, and wrap all code under this condition. This way a second domready event triggering won't cause all your code to execute twice.