jlmakes / scrollreveal

Animate elements as they scroll into view.
https://scrollrevealjs.org/
22.39k stars 2.26k forks source link

scroll reveal works on scroll up but not on scroll down #486

Closed tiaz90 closed 5 years ago

tiaz90 commented 5 years ago

Hello,

I know there is another post with the same problem and I tried to solve the problem setting as you've said:

body {
  height: 100%
}

But unfortunately it didn't work. Can someone help me? These are my settings in the header

<header>
    <script src="https://unpkg.com/scrollreveal/dist/scrollreveal.min.js"></script>
    <script>
        ScrollReveal({ distance: '50px', origin: 'top', viewFactor: 0.4});
    </script>
</header>

Windows 10 - Chrome 71 - ScrollReveal 4

jlmakes commented 5 years ago

Be careful using options.viewFactor, that can cause unexpected behavior with very large elements. Also, ScrollReveal 4 adds body { height: 100%; } for you, so you no longer need to do that yourself.

Can you provide some demonstration of the problem? (Either a link to your site, or a JSBin)

tiaz90 commented 5 years ago

it's not easy on JSBin because my site run with four css file and it takes only one and i should put the entire html...i did as you told me, i removed height: 100% and the viewfactor, but the problem remains...maybe does it depend from the fact that i put all the ScrollReveal().reveal( target, options ) in the same script before the end of the body?

jlmakes commented 5 years ago

I can't effectively help you debug your project only by trading messages here on GitHub. If it’s too difficult to recreate the problem using JSBin, then I would suggest hosting your site somewhere temporarily.

tiaz90 commented 5 years ago

I've loaded the site:

https://exigeant-boresight.000webhostapp.com/

The ScrollReveal works only if you recharge, you can see it scrolling half page.

Thanks for your patience

jlmakes commented 5 years ago

You’ve got a number of large images on the site, which can throw off element position/size calculations; if ScrollReveal checks before an image has finished loading, it's possible it’ll capture incorrect data.

That said, I'd first like you try adding html { height: 100%; } to your CSS. (I didn’t think it was necessary, but I have a suspicion that it may make a difference in your case.)

tiaz90 commented 5 years ago

It works, I set the html's height as you told me and now it's perfect....Thank you very much for your patience, if you lived near me i would offer you a coffee.