(function() {
var header = document.getElementById('header'),
headerIsFixed = false,
headerTop = header.getBoundingClientRect().top;
window.addEventListener('scroll', function() {
if(this.pageYOffset >= headerTop != headerIsFixed) {
headerIsFixed = !headerIsFixed;
header.classList[headerIsFixed ? 'add' : 'remove']('fixed');
}
});
})();