I have the exact same jQuery function on two Drupal 8 websites with jQuery 3.2.1
Now something strange happens. Visiting the website with IE11 or 11, on one website the code is working without problems but on the other one it doesn't work. On one of the pages the expected class is not beeing added to the header element. I can see this in the IE developer tools.
I've tried the code without the scroll function and it works on both sites. But I can't figure out why the function works only on one of the sites...
$(window).scroll(function(){
if ($(window).scrollTop() >= 1) {
$('header').addClass('sticky');
}
else {
$('header').removeClass('sticky');
}
});
Does someone have an idea?