From: Brett Mason Date: Thu, 17 Nov 2016 08:41:44 +0000 (+0000) Subject: Add _stopScrolling function to fix iOS issue. X-Git-Tag: v6.3-rc1~6^2~11^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21b37254735d16a05d61b84ecbc74acf946fa622;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Add _stopScrolling function to fix iOS issue. --- diff --git a/js/foundation.offcanvas.js b/js/foundation.offcanvas.js index c61cc4887..08347c6b5 100644 --- a/js/foundation.offcanvas.js +++ b/js/foundation.offcanvas.js @@ -146,6 +146,16 @@ class OffCanvas { } } + /** + * Stops scrolling of the body when offcanvas is open on mobile Safari and other troublesome browsers. + * @private + */ + _stopScrolling(event) { + event.preventDefault(); + event.stopPropagation(); + return false; + } + /** * Opens the off-canvas menu. * @function @@ -177,6 +187,7 @@ class OffCanvas { // If we have an overlay lets make it visible. if (this.options.contentOverlay) { + $('body').on('touchmove', this._stopScrolling); this.$overlay.addClass('is-visible'); } @@ -247,6 +258,7 @@ class OffCanvas { // Remove `is-visible` class from overlay. if (this.options.contentOverlay) { + $('body').off('touchmove', this._stopScrolling); this.$overlay.removeClass('is-visible'); }