- navigation
---
-<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
+## Usage
-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
+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
```html
<ul class="horizontal menu" data-smooth-scroll>
</div>
```
-You can also setup SmoothScroll directly via indiviual link.
+You can also apply `data-smooth-scroll` attribute directly to the link.
```html
<a href="#exclusive" data-smooth-scroll>Exclusive Section</a>
/**
* Function to scroll to a given location on the page.
* @param {String} loc - A properly formatted jQuery id selector. Example: '#foo'
- * @param {Object} options - The options to use.
- * @param {Function} callback - The callback function.
+ * @param {Object} options - Overrides to the default plugin settings.
+ * @param {Function} callback - The callback function when scroll animation is finished.
* @static
* @function
*/
- static scrollToLoc(loc, options = SmoothScroll.defaults, callback) {
+ static scrollToLoc(loc, options, 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(