function Scrolldown() {
window.scroll(0,300);
}
How can I use this function (or a similar one) to automatically scroll down when the page loads? (without clicking a link)
Regards,
taylor
function Scrolldown() {
window.scroll(0,300);
}
How can I use this function (or a similar one) to automatically scroll down when the page loads? (without clicking a link)
Regards,
taylor
Give this a try:
function Scrolldown() {
window.scroll(0,300);
}
window.onload = Scrolldown;
you could include all of your javascript in an event. This will scroll to an element with an id.
<body onload="window.location='#myID';">
You could use window.onload
:
window.onload = Scrolldown;
I also want to point out that you could use an HTML anchor to indicate where to scroll to, so you don't have to hard-code the pixel value:
<div id="iWantToScrollHere" name="iWantToScrollHere">
...
</div>
...which would make your Scrolldown
function:
function Scrolldown() {
window.location.hash = '#iWantToScrollHere';
}
well, another super simple script is here,
<script type="text/javascript">
window.onload = function(e){
window.scrollBy(1,1);
}
it worked best for me.
you could include jquery:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
and then wrap your scrolling thing in a document ready function:
$(document).ready(function(){
window.scroll(0,300);
});
then after that you don't need to do anything.
:)