Window scrollBy() Method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








googletag.cmd.push(function() googletag.display('div-gpt-ad-1422003450156-2'); );



Window scrollBy() Method


❮ Window Object



Example


Scroll the document by 100px horizontally:



window.scrollBy(100, 0); // Scroll 100px to the right

Try it Yourself »

More "Try it Yourself" examples below.



Definition and Usage


The scrollBy() method scrolls the document by the specified number of pixels.


Note: For this method to work, the visible property of the window's scrollbar must be set to true!



Browser Support














Method
scrollBy() Yes Yes Yes Yes Yes

Syntax



window.scrollBy(xnum, ynum)

Parameter Values











Parameter Type Description
xnum Number Required. How many pixels to scroll by, along the x-axis (horizontal). Positive values will scroll to the right, while negative values will scroll to the left
ynum Number Required. How many pixels to scroll by, along the y-axis (vertical). Positive values will scroll down, while negative values scroll up






googletag.cmd.push(function() googletag.display('div-gpt-ad-1493883843099-0'); );





Technical Details




Return Value: No return value

More Examples



Example


Scroll the document by 100px vertically:



window.scrollBy(0, 100); // Scroll 100px downwards

Try it Yourself »



Example


Scroll the document horizontally and vertically:



<button onclick="scrollWin(0, 50)">Scroll down</button>
<button onclick="scrollWin(0, -50)">Scroll up</button>
<button onclick="scrollWin(100, 0)">Scroll right</button>
<button onclick="scrollWin(-100, 0)">Scroll left</button>

<script>
function scrollWin(x, y)

  window.scrollBy(x, y);

</script>

Try it Yourself »


Related Pages


Window Object: scrollTo() Method




❮ Window Object

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)