tags:

views:

46

answers:

1
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

A: 

Chrome and Safari don't like the "body" element to be the target of scrolling requests like that. I'm not sure what the details are, but it doesn't work. Instead of doing that, put your own outer-level <div> that's sized to fill the whole <body>, and scroll that instead.

Pointy