Automatic Scrolling. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Automatic Scrolling.

Anyone knows a function to automatically scroll this webpage? When the text goes outside the screen, that is... https://code.sololearn.com/Wd11EJWU7Zo6/?ref=app

18th Feb 2020, 3:51 PM
Nor'wester 🌪️ 🇧🇩 (INACTIVE)
Nor'wester 🌪️ 🇧🇩 (INACTIVE) - avatar
4 Answers
+ 3
let ctnrElem = document.getElementById("container"); ctnrElem.scrollTop = ctnrElem.scrollHeight; https://code.sololearn.com/W35wQ3nWJccr/?ref=app
18th Feb 2020, 4:21 PM
Gordon
Gordon - avatar
+ 12
An alternative solution to Gordon code is to add the following at the bottom of generate() function document.getElementById("strnd").scrollIntoView({block: "end"});
18th Feb 2020, 4:54 PM
Burey
Burey - avatar
+ 7
Gordon 😬
18th Feb 2020, 5:13 PM
Burey
Burey - avatar
+ 4
Burey wow, learned something new, thanks.
18th Feb 2020, 5:05 PM
Gordon
Gordon - avatar