I would like to auto scroll my page using js. Example page with big image:
<html>
<body>
<IMG SRC="some_image.jpg" ALT="some text">
</body>
</html>
I found here how to do it but I don't understand how to use it.
Could some one write me how to use that function?
function pageScroll() {
window.scrollBy(0,1);
scrolldelay = setTimeout('pageScroll()',10);
}
I understand it must be betwen tags but I guess thats not enought
ok small edit:
I found something like this and it works
<script src="jquery.js"></script>
<script>
$(document).ready(function () {
setInterval(function () {
var iScroll = $(window).scrollTop();
iScroll = iScroll + 200;
$('html, body').animate({
scrollTop: iScroll
}, 1000);
}, 2000);
});
</script>
The problem is I have to scroll my content which is in iframe How to modify this?
edit2:
I change my code as you said now it looks like this:
<html>
<body>
<script src="jquery.js"></script>
<script>
$(document).ready(function () {
setInterval(function () {
var iScroll = $("myframe")[0].conetentWindow.scrollTop;
iScroll = iScroll + 200;
$('html, body', parent.document).animate({
scrollTop: iScroll
}, 1000);
}, 2000);
});
document.write('<iframe src="http://link_to_image/image.jpg" name="myframe" height="50%" width="50%"></iframe>')
</script>
</body>
</html>
But it doesn't scroll my frame :/