Skip to content

Instantly share code, notes, and snippets.

@kalenjohnson
Created February 14, 2015 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalenjohnson/497b644cc27fd4520e7e to your computer and use it in GitHub Desktop.
Save kalenjohnson/497b644cc27fd4520e7e to your computer and use it in GitHub Desktop.
var affix = $('#affix-container');
affix.affix({
offset: {
top: function() {
if ($('#carousel-motivate').length !== 0) {
if ($('body').hasClass('admin-bar')) {
return (
$('#wpadminbar').outerHeight() +
$('.top-nav').outerHeight() +
$('.banner').outerHeight() +
$('#carousel-motivate').outerHeight()
);
}
return (
$('.top-nav').outerHeight() +
$('.banner').outerHeight() +
$('#carousel-motivate').outerHeight()
);
}
if ($('body').hasClass('admin-bar')) {
return (
$('#wpadminbar').outerHeight() +
$('.top-nav').outerHeight() +
$('.banner').outerHeight()
);
}
return (
$('.top-nav').outerHeight() +
$('.banner').outerHeight()
);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment