I wrote a small jquery code which fades out an overlay by changing the opacity while scrolling down. I thought everything was working fine, but unfortunately on some, obviously older, PCs the fade effect isn't smooth and stutters. However on my PC everything is perfect.
Here my script:
$(window).on('scroll', function() {
var scrollTop = $(this).scrollTop();
if($('.overlay').is(':visible') || (scrollTop < lastScrollTop)){
if ($(this).scrollTop() < 150) {
$('.overlay').show();
$('.overlay').css('opacity', (150 - $(this).scrollTop()) / 150);
$('.container-gesamt').css('padding-top', $(this).scrollTop());
}else{
$('.overlay').hide();
}
}
lastScrollTop = scrollTop;
});
To my mind it must be a problem of older hardware, or what do you think?
And if so, do you know if there is a way to make the effect smooth on older hardware?