From: NikhilKalige Date: Mon, 10 Feb 2014 16:50:56 +0000 (+0530) Subject: offcanvas animation fix for anchor tags X-Git-Tag: v5.2.0~54^2~2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4414%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git offcanvas animation fix for anchor tags A fix for #4411. I have added bind event for transition end, that triggers the href jump once the transition is done. I am not sure if it is the proper way. But it works and i have tested in latest versions of firefox and chrome. --- diff --git a/js/foundation/foundation.offcanvas.js b/js/foundation/foundation.offcanvas.js index df688ef49..0bbfc7853 100644 --- a/js/foundation/foundation.offcanvas.js +++ b/js/foundation/foundation.offcanvas.js @@ -24,6 +24,15 @@ e.preventDefault(); S(".off-canvas-wrap").removeClass("move-right"); }) + .on('click.fndtn.offcanvas', '.left-off-canvas-menu a', function (e) { + e.preventDefault(); + var href = $(this).attr('href'); + S('.off-canvas-wrap').on('transitionend webkitTransitionEnd oTransitionEnd', function(e) { + window.location = href + S('.off-canvas-wrap').off('transitionend webkitTransitionEnd oTransitionEnd'); + }); + S(".off-canvas-wrap").removeClass("move-right"); + }) .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) { e.preventDefault(); S(this).closest(".off-canvas-wrap").toggleClass("move-left"); @@ -31,6 +40,15 @@ .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) { e.preventDefault(); S(".off-canvas-wrap").removeClass("move-left"); + }) + .on('click.fndtn.offcanvas', '.right-off-canvas-menu a', function (e) { + e.preventDefault(); + var href = $(this).attr('href'); + S('.off-canvas-wrap').on('transitionend webkitTransitionEnd oTransitionEnd', function(e) { + window.location = href + S('.off-canvas-wrap').off('transitionend webkitTransitionEnd oTransitionEnd'); + }); + S(".off-canvas-wrap").removeClass("move-left"); }); },