]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
docs: add doc for Reveal methods _addGlobalClasses/_removeGlobalClasses 11341/head
authorNicolas Coden <nicolas@ncoden.fr>
Mon, 18 Jun 2018 21:30:26 +0000 (23:30 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Mon, 18 Jun 2018 21:30:26 +0000 (23:30 +0200)
js/foundation.reveal.js

index 0c6dcf98ba555da7c00e522603300bea5b1bfa96..27875c26659d1319f7cb2a134a877fc20f6e3a23 100644 (file)
@@ -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');