Skip to content

Instantly share code, notes, and snippets.

@jdcauley
Created March 31, 2016 16:31
Show Gist options
  • Save jdcauley/2dec5e9c3fc1e13021dedc4d39b46480 to your computer and use it in GitHub Desktop.
Save jdcauley/2dec5e9c3fc1e13021dedc4d39b46480 to your computer and use it in GitHub Desktop.
bootstrap affix for widgets
var StickyWidget = $('.sidebar .widget:last-child');
if(StickyWidget){
var trigger = StickyWidget.offset().top - $('#primary-masthead').height();
StickyWidget.affix({
offset: {
top: function(){
return trigger;
},
bottom: function () {
return (this.bottom = $('.footer-wrap').outerHeight(true))
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment