javascript - Zurb Foundation Offcanvas Menu stops working after toggling programmatically -
i use zurb foundation 5 in wordpress theme offcanvas menu, working fin in gerneral, have come across problem:
in addition hamburger icon in top bar, give option open menu when clicking on fixed position div element .back-to-menu. achieve this, used method open offcanvas menu programmatically described in zurb's docs. while works fine, after i've clicked on div.back-to-menu open menu , close menu again, can't seem open menu clicking on hamburger icon in top bar more.
this code open menu:
jquery('.back-to-menu').click(function(event) { event.preventdefault(); jquery('html, body').animate({scrolltop: 0}, duration); settimeout(function() { $('.off-canvas-wrap').foundation('offcanvas', 'show', 'move-right'); }, duration); return false; })
can help?
this seems bug in foundation, when execute script on foundation documentation page same error occurs, menu opens , closes broken.
a workaround trigger offcanvas simulating click on hamburger icon:
settimeout(function() { $('.off-canvas-wrap').find('.left-off-canvas-toggle').click(); }, duration);
this isn't neat using "official" way, faily foolproof , better breaking menu after using it.
apparently there issue filed @ foundation github , same workaround proposed long it's unfixed.
Comments
Post a Comment