Skip to content

Instantly share code, notes, and snippets.

@raazon
Last active September 22, 2019 11:02
Show Gist options
  • Save raazon/a3b7d32efadc14336f56c95b4e27c4dc to your computer and use it in GitHub Desktop.
Save raazon/a3b7d32efadc14336f56c95b4e27c4dc to your computer and use it in GitHub Desktop.
Dynamic page content margin for fixed header
(function ($) {
"use strict";
// ========== Dynamic page content margin for fixed header JS Start ==========
$(window).on('resize load', function () {
var headerHeight = jQuery('#header').outerHeight();
var pageContentWrap = jQuery('#page-content-wrapper');
if(pageContentWrap.length){
pageContentWrap.css('margin-top', headerHeight);
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment