Skip to content

Commit

Permalink
added an offset for a fixed header.
Browse files Browse the repository at this point in the history
  • Loading branch information
damiandennis committed Oct 8, 2014
1 parent 7d56a77 commit fc2ad7f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stickyMojo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
var settings = $.extend({
'footerID': '',
'contentID': '',
'orientation': $(this).css('float')
'orientation': $(this).css('float'),
'offsetTop': 0
}, options);

var sticky = {
Expand Down Expand Up @@ -71,7 +72,7 @@
function setFixedSidebar() {
sticky.el.css({
position: 'fixed',
top: 0
top: settings.offsetTop+'px'
});
}

Expand Down Expand Up @@ -103,8 +104,7 @@
//determines whether sidebar should stick and applies appropriate settings to make it stick
function stick() {
var tops = calculateLimits();
var hitBreakPoint = tops.stickyTop < tops.windowTop && (sticky.win.width() >= sticky.breakPoint);

var hitBreakPoint = tops.stickyTop < tops.windowTop + settings.offsetTop && (sticky.win.width() >= sticky.breakPoint);
if (hitBreakPoint) {
setFixedSidebar();
checkOrientation();
Expand Down

0 comments on commit fc2ad7f

Please sign in to comment.