---
<div data-sticky-container>
<div class="sticky" id="sticky-magellan" style="width:100%;" data-sticky data-margin-top="0" data-margin-bottom="0" data-top-anchor="setup" data-btm-anchor="destroy:bottom">
- <nav data-magellan class="sticky-mag">
+ <nav data-magellan class="sticky-mag" data-bar-offset="25">
<ul class="horizontal menu expanded">
<li><a href="#setup">Setup</a></li>
<li><a href="#sticky-navigation">Sticky Navigation</a></li>
*/
function Magellan(element, options) {
this.$element = element;
- this.options = $.extend({}, Magellan.defaults, options);
+ this.options = $.extend({}, Magellan.defaults, this.$element.data(), options);
this._init();
* @option
* @example true
*/
- deepLinking: false
+ deepLinking: false,
+ /**
+ * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
+ * @option
+ * @example 25
+ */
+ barOffset: 0
};
/**
}).on('click.zf.magellan', 'a[href^="#"]', function(e) {
e.preventDefault();
var arrival = this.getAttribute('href'),
- scrollPos = $(arrival).offset().top - _this.options.threshold / 2;
+ scrollPos = $(arrival).offset().top - _this.options.threshold / 2 - _this.options.barOffset;
// requestAnimationFrame is disabled for this plugin currently
// Foundation.Move(_this.options.animationDuration, $body, function(){