How to use Window Object ScrollTo in JavaScript
In this article I am going to explain about window object ScrollTo() Method in JavaScript.
JavaScript Window Object ScrollTo() Method
JavaScript ScrollTo() method also use for scroll the content on the page but main purpose of this is to scroll the specifies number of coordinate on the the page.
Syntax
Example
<html>
<head>
<script type="text/javascript">
function myfun() {
window.scrollTo(100, 200);
}
</script>
</head>
<body>
<button onclick="myfun()">
click me</button>
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<br />
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<br />
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<br />
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<br />
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<p>
Window object Scroll() method</p>
<br />
<br />
<br />
<br />
</body>
</html>
|
Output
After button click
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here