Return to Snippet

Revision: 37717
at December 15, 2010 21:22 by madr


Initial Code
    // found at http://stackoverflow.com/questions/871399/cross-browser-method-for-detecting-the-scrolltop-of-the-browser-window
    function getScrollTop(){
        if(typeof pageYOffset!= 'undefined'){
            //most browsers
            return pageYOffset;
        }
        else{
            var B= document.body; //IE 'quirks'
            var D= document.documentElement; //IE with doctype
            D= (D.clientHeight)? D: B;
            return D.scrollTop;
        }
    }

Initial URL

                                

Initial Description

                                

Initial Title
Cross browser scrollTop

Initial Tags
javascript, textmate, DOM

Initial Language
Other