Reputation: 2275
I have the simple fadeIn
function below. It works perfectly in Chrome, but for some reason does not work in FireFox or Internet Explorer.
How can I fix this, so it works for all browsers?
function fadeinGray(){
$('.dark-gray').fadeTo(1600, 1);
}
.dark-gray {
height: 500px;
width: 100%;
background-color: #202020;
opacity: 0.1;
}
Upvotes: 1
Views: 70
Reputation: 2683
got it, you need to change the line var pTop = $("body").scrollTop();
to var pTop = $(document).scrollTop();
you pTop
var always returns 0 in some browsers, because of which it wasn't entering into the condition to execute your function fadeinGray
Upvotes: 1