scrollTop in defferent browers.

Posted by zjm1126 on Stack Overflow See other posts from Stack Overflow or by zjm1126
Published on 2010-03-03T04:41:34Z Indexed on 2010/05/16 9:10 UTC
Read the original article Hit count: 204

Filed under:
shortcut.add("up",function() {
        alert( document.body.scrollTop)
            if (document.documentElement&& typeof document.documentElement.scrollTop=='number'){
                    document.documentElement.scrollTop-=100

                }
            else if (document.body) {
                document.body.scrollTop-=100
                }
        })
    shortcut.add("down",function() {
            if (document.documentElement&&typeof document.documentElement.scrollTop=='number' ){
                    document.documentElement.scrollTop+=100
                }
            else if (document.body) {
                document.body.scrollTop+=100
                }
        })

it can running in firefox,but not in chrome and safari

thanks

© Stack Overflow or respective owner

Related posts about JavaScript