Remove class depending on site height in refresh?

Asked

Viewed 46 times

0

I own a website with animation that starts as soon as the object on the screen is visualized. However, if I give F5 in the middle of the page, by climbing to the mean refresh top in the middle of the screen, the animation happens and should not..

There is how I remove the class from the div’s, which make the animation happen, if the page load or refresh is not at the top?

  • 2

    How to do this yes I would like to see the code snippet or an example to help in a more consistent way.

  • When you refresh the page the code runs again as if it were the first time. There is the factor "chache", IE, some files will not be pulled again from the internet, but otherwise it is as if loading the page the first time.

1 answer

1

Use jquery for scroll events (see: http://api.jquery.com/scroll/), to know the position of the scroll, then save in browser cookies when the scroll is at the top of the page or when it is below the top, and then before executing the animation in refresh, you check the value of the cookie to know whether or not to execute.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.