Becky
Becky

Reputation: 2275

FadeIn not working for FireFox/Internet Explorer

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

Answers (1)

ameenulla0007
ameenulla0007

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

Related Questions