php - auto scroll animation with javascript
one text
Since I didn't know exactly how to search the question on Google, I always came across with wrong answers.
for ($i = 1; $i <= 100; $i++) {
// wait 0.1 sec
usleep(100000); // 100000 = 0.1 sec
echo '<p>' . $i . '</p>';
ob_flush();
flush();
}
I'm printing numbers from 1 to 100 with the for loop. But it waits 0.1 seconds before printing each number. As the numbers are pressed one after the other, after a certain time the scroll is visible on the right. What I want to do is have the scroll follow the bottom number even if the number exceeds the page size. I can do it with ajax by including the process from another page on this page, but I think this will affect the speed of the program.
Source