[ACCEPTED]-Javascript mechanism to autoscroll to the bottom of a growing page?-scroll

Accepted answer
Score: 13
x = 0;  //horizontal coord
y = document.height; //vertical coord
window.scroll(x,y);

0

Score: 7

To scroll the whole document use this:

window.scrollTo(0, document.body.scrollHeight);

if 2 you have just a single scrollable div or 1 something then the process is different:

var obj = $('id');
obj.scrollTop = obj.scrollHeight;
Score: 4
for (i = 0; i < 100; i++) {
    document.write("" + i + "<br />");
    window.scroll(0,document.body.offsetHeight);
}

0

Score: 4

Nice jQuery function gets this done

$('html,body').animate({ scrollTop: element.offset().top }, 'slow');

This 2 worked for me, used it to AutoScroll to 1 a dropdown menu to bring it into focus

Score: 1

This Explains What set time interval is 3 - http://www.w3schools.com/jsref/met_win_setinterval.asp

This Explains What set time out is - http://www.w3schools.com/jsref/met_win_settimeout.asp

This 2 will scroll the page with javascript and 1 will stop after 6 seconds

    <script type = "text/javascript" >

    var x;
    function autoscroll(){
    self.scrollBy(0,x)
    }

    function playautoscroll(){
    x = 1;
    setInterval('autoscroll()',0.01);
    stop();}

    function onetozero(){
    x=0;
    }

    function stop(){
    setTimeout ("onetozero()",6000);
    }
    window.onload=playautoscroll

    </script>
Score: 0
obj.scrollTop = obj.scrollHeight;

0

More Related questions