]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Revert "Improvements" 11652/head 9636/head
authorNordanne Isahac <den.isahac@gmail.com>
Mon, 20 Feb 2017 00:06:08 +0000 (08:06 +0800)
committerNordanne Isahac <den.isahac@gmail.com>
Mon, 20 Feb 2017 00:06:08 +0000 (08:06 +0800)
This reverts commit ffdc71d8e882a7d5eb32e3b69c7487ce01895994.

docs/pages/smooth-scroll.md
js/foundation.smoothScroll.js

index 54faacc9bf2b3b111f85eec648fe41155e01c98a..59327576f7f747f8e566f2a8b6d538bcc792369e 100644 (file)
@@ -6,9 +6,16 @@ tags:
   - navigation
 ---
 
-## Usage
+<ul class="menu vertical" data-smooth-scroll>
+  <li><a href="#setup">Setup</a></li>
+  <li><a href="#javascript-reference">Javascript Reference</a></li>
+</ul>
+
+<br>
+
+## Setup
 
-To enable smooth scrolling on internal links add the attribute `data-smooth-scroll` to the parent container like our [Menu](menu.html). Each section needs a unique ID
+To enable SmoothScroll on internal links, just add the attribute `data-smooth-scroll` to the parent container like our [Menu](menu.html). Each section needs a unique ID
 
 ```html
 <ul class="horizontal menu" data-smooth-scroll>
@@ -23,7 +30,7 @@ To enable smooth scrolling on internal links add the attribute `data-smooth-scro
 </div>
 ```
 
-You can also apply `data-smooth-scroll` attribute directly to the link.
+You can also setup SmoothScroll directly via indiviual link.
 
 ```html
 <a href="#exclusive" data-smooth-scroll>Exclusive Section</a>
index b749516c3bdc2336cd2847a31912ae5c70a141b7..f81a8a14c1f4b49409859ff7cc3b6d1fa1d3273c 100644 (file)
@@ -62,19 +62,17 @@ class SmoothScroll {
     /**
      * Function to scroll to a given location on the page.
      * @param {String} loc - A properly formatted jQuery id selector. Example: '#foo'
-     * @param {Object} options - Overrides to the default plugin settings.
-     * @param {Function} callback - The callback function when scroll animation is finished.
+     * @param {Object} options - The options to use.
+     * @param {Function} callback - The callback function.
      * @static
      * @function
      */
-    static scrollToLoc(loc, options, callback) {
+    static scrollToLoc(loc, options = SmoothScroll.defaults, callback) {
         // Do nothing if target does not exist to prevent errors
         if (!$(loc).length) {
             return false;
         }
 
-        options = $.extend({}, SmoothScroll.defaults, options);
-
         var scrollPos = Math.round($(loc).offset().top - options.threshold / 2 - options.offset);
 
         $('html, body').stop(true).animate(