JS

$(document).scrollTop() always returns 0 in Safari Browser

Please removing ‘height: 100%’ from my html and body tags.

$(window).scroll(function() {
var sh = $(window).scrollTop();
console.log(sh);
if ( sh > 700 ) {
$(‘#top img’).fadeIn(); //hide
} else {
$(‘#top img’).fadeOut(); //show
}
});

Advertisement

Did you find this helpful? Share it!

Leave a Comment

Your email address will not be published. Required fields are marked