From 96141b743c2a1010d1bfe522170d36eabe951028 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Mon, 18 Jun 2018 23:30:26 +0200 Subject: [PATCH] docs: add doc for Reveal methods _addGlobalClasses/_removeGlobalClasses --- js/foundation.reveal.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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'); -- 2.47.2