javascript : detect at the end of bottom

    function isScrollBottom() {
        var documentHeight = document.documentElement.scrollHeight;
        var winHeight = document.documentElement.clientHeight;
        var scrollPosition = winHeight + getScrollTop();
        return console.log(documentHeight == scrollPosition); 
    }

    function getScrollTop() {
        if (typeof pageYOffset != 'undefined') {
            //most browsers except IE before #9
            return pageYOffset;
        }
        else {
            var B = document.body; //IE 'quirks'
            var D = document.documentElement; //IE with doctype
            D = (D.clientHeight) ? D : B;
            return D.scrollTop;
        }
    } 

 

posted @ 2014-11-16 14:13  泉油  阅读(132)  评论(0编辑  收藏  举报
Web Design Johor Bahru Malaysia - Stooges