Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <style> #smallDiv { height: 100px; background-color: blue; } #bigDiv { height: 1000px; background-color: green } </style> </head> <body> <div id="smallDiv"> <button id='btn'>Scroll the document vertically by 100 pixels</button> </div> <div id="bigDiv"></div> <script> btn.addEventListener('click', () => window.scrollBy(0, 100)); </script> </body> </html>