I wrote this simple jQuery onScroll function, which adds a class when scrollTop() is bigger than 15. This works 100% in Chrome, Firefox and Safari. Of cause this blows up in IE and I have no idea why. Could anyone please give advice on this :) thank you. Find my code below.
HTML:
<div class="promo-header">
<img src="imgs/promo-header.jpg" alt="" />
</div>
Scss:
.promo-header {
background-size: cover;
display: none;
overflow: hidden;
position: relative;
transition: visibility .3s, height .3s;
visibility: hidden;
will-change: visibility, height;
&.is-hidden {
height: 0;
visibility: hidden;
}
}
jQuery:
$(window).on('scroll', function() {
if($(this).scrollTop() >= 15) {
$('.promo-header').addClass('is-hidden');
}
})