Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maciej-szlosarczyk/544d6150d224abe0591fe32833ea5951 to your computer and use it in GitHub Desktop.
Save maciej-szlosarczyk/544d6150d224abe0591fe32833ea5951 to your computer and use it in GitHub Desktop.
function responsive() {
function initResponsive() {}
$(window).scroll(function () {
if (window.matchMedia("(max-width: 1024px)").matches && $(document).scrollTop() > 0) {
$('.main-header').addClass('u-fixed');
} else {
$('.main-header').removeClass('u-fixed');
}
});
$(window).resize(function () {
initResponsive();
});
$(document).ready(function () {
initResponsive();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment