add event to all image elements using javascript

Page scroll up and down in javascript

Document or web-page scrolling is very easy through javascript. In this article we given code for Page scroll up and down in javascript. We used JS methods.

 Page scroll up and down in javascript

window.scrollBy(10,20); // horizontal and vertical scroll increments or decrements.

Using scrollBy function you can create custom event or function based on project requirement.

Here I am giving you the sample code: Up scrolling and down scrolling


//For Upscrolling:

function ScrollUp() {
window.scrollBy(0,100);
}

//For Down scrolling:
function ScrollDown() {
window.scrollBy(0,-100);
}

In same way you can create your own functions.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.