How to make scrolling smooth?

I wrote a scroller function that will scroll one div inside another. The idea is to use the setInterval method to change the field of an internal element to simulate a scrollable div.

The problem I am facing is that scrolling is not completely smooth. Sometimes it stops for a split second, and then resumes. What can I do to remove these random hiccups? (I move 1px in 20 milliseconds)

+3
source share
2 answers

three comments that can give an answer:

I see that you are already using jQuery. It has scroll functions that were smooth for me.

? MarginTop - = 0,7;

, , , clearInterval(), div, , .

, , , .

HTH

+1

, , , Smooth Div Scroll jQuery, , : div .

0

Source: https://habr.com/ru/post/1752248/


All Articles