21 June 2013

How do we determine the end of page in browser?

In facebook application the page is not completely loaded at once. It is loaded partially and when we drag the scroll bar to the bottom then some more part of the page gets loaded but how this is detected?

Answer:-

A simple java script can be solve this problem


window.onscroll = function(ev) 
{
    if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) 
    {
        alert("Bottom of page is reached");
    }
};

No comments: