Latest web development tutorials

Window scrollBy () method

Window Object Reference Window object

Definition and Usage

scrollBy () method is the number of pixels to scroll through the contents specified.

Note: For this method to work window scroll bar must be visible property is set to true!

grammar

scrollBy(xnum,ynum)

parameter description
xnum Required. The number of pixels to scroll the document to the right.
ynum Required. The number of pixels to scroll down the document.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support scrollBy () method


Examples

Examples

Scroll 100 pixels of content:

function scrollWindow () {
window.scrollBy (100,100);
}

try it"


Window Object Reference Window object