+ 2
Scroll
I have written a code. I want my div element to scroll 10 px vertically each time when i click the move button but it's happening only once. https://code.sololearn.com/WCo41HD6s85Z/?ref=app
3 Réponses
+ 1
Try this if works
document.getElementById("dn").scrollTop += "10";
also add some content to it to see effect better way
+ 3
Also don't forget to change the quotation marks between 10 in line 12.
Or else each time you press it it would add two strings like
"10" + "10" = "1010"
0
Thanks its working now