From: Nicolas Coden Date: Mon, 18 Jun 2018 21:30:26 +0000 (+0200) Subject: docs: add doc for Reveal methods _addGlobalClasses/_removeGlobalClasses X-Git-Tag: v6.6.0~3^2~148^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11341%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git docs: add doc for Reveal methods _addGlobalClasses/_removeGlobalClasses --- diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index 0c6dcf98b..27875c266 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -324,6 +324,17 @@ class Reveal extends Plugin { this.$element.trigger('open.zf.reveal'); } + /** + * Adds classes and listeners on document required by open modals. + * + * The following classes are added and updated: + * - `.is-reveal-open` - Prevents the scroll on document + * - `.zf-has-scroll` - Displays a disabled scrollbar on document if required like if the + * scroll was not disabled. This prevent a "shift" of the page content due + * the scrollbar disappearing when the modal opens. + * + * @private + */ _addGlobalClasses() { const updateScrollbarClass = () => { $('html').toggleClass('zf-has-scroll', !!($(document).height() > $(window).height())); @@ -334,6 +345,10 @@ class Reveal extends Plugin { $('html').addClass('is-reveal-open'); } + /** + * Removes classes and listeners on document that were required by open modals. + * @private + */ _removeGlobalClasses() { this.$element.off('resizeme.zf.trigger.revealScrollbarListener'); $('html').removeClass('is-reveal-open');