Javascript before scrolling redrawing?

I have javascript function in onscoll event to change div style.

The problem is that most browsers draw a div after scoll, but before the onscoll event fires, so you get 1 or 2 frames where the div has the old style, but the viewport is in the new scroll position. This can cause ugly flicker.

How do you prevent this?

+3
source share
1 answer

It is possible for the body to overflow: hidden to start, and change it to overflow: automatically after the first onscroll starts.

0
source

All Articles