]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: clean SmoothScroll events when destroyed
authorNicolas Coden <nicolas@ncoden.fr>
Fri, 28 Sep 2018 20:50:10 +0000 (22:50 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Fri, 28 Sep 2018 21:24:30 +0000 (23:24 +0200)
js/foundation.smoothScroll.js

index 9d5f9c656b5a522d5447fad7430aff7ce5d82672..ce8eda91956f467f65054972df73d4c45db39bef 100644 (file)
@@ -91,6 +91,15 @@ class SmoothScroll extends Plugin {
             }
         );
     }
+
+    /**
+     * Destroys the SmoothScroll instance.
+     * @function
+     */
+    _destroy() {
+        this.$element.off('click.zf.smoothScroll', this._handleLinkClick)
+        this.$element.off('click.zf.smoothScroll', 'a[href^="#"]', this._handleLinkClick);
+    }
 }
 
 /**