Skip to content

Commit

Permalink
Threshold implemented & fixed top option added
Browse files Browse the repository at this point in the history
Threshold option was not implemented - update to implement
Option included to specify the css "top" distance for the fixed element
  • Loading branch information
campbellwmorgan committed Apr 14, 2014
1 parent 30c2e0a commit 9cc7098
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/foundation/foundation.magellan.js
Expand Up @@ -10,7 +10,8 @@
active_class: 'active',
threshold: 0, // pixels from the top of the expedition for it to become fixes
destination_threshold: 20, // pixels from the top of destination for it to be considered active
throttle_delay: 30 // calculation throttling to increase framerate
throttle_delay: 30, // calculation throttling to increase framerate
fixed_top: 0 // top distance in pixels assigend to the fixed element on scroll
},

init : function (scope, method, options) {
Expand Down Expand Up @@ -70,7 +71,7 @@
top_offset;

expedition.attr('style', '');
top_offset = expedition.offset().top;
top_offset = expedition.offset().top + self.settings.threshold;

expedition.data(self.data_attr('magellan-top-offset'), top_offset);
expedition.attr('style', styles);
Expand All @@ -95,7 +96,7 @@
placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
expedition.before(placeholder);
}
expedition.css({position:'fixed', top: 0});
expedition.css({position:'fixed', top: self.settings.fixed_top});
} else {
expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
expedition.attr('style','');
Expand Down

0 comments on commit 9cc7098

Please sign in to comment.