前端学堂
学有所用

完成函数getScrollOffset返回窗口滚动条偏移量

面试笔试完成函数getScrollOffset返回窗口滚动条偏移量
0
前端学堂 管理员 asked 2 years ago
Kassandra replied 2 weeks ago

Cbd oil that works 2020
Asking questions are in fact good thing if you are not understanding
anything entirely, except this article offers fastidious
understanding yet. best cbd oil for pain http://tinyurl.com/cbd-oil-that-works-2020 cbd oil that works 2020
http://tinyurl.com/cbd-oil-that-works-2020

Quyen replied 2 weeks ago

WOW just what I was searching for. Came here by searching for cbd oil (anthinhminerals.vn)

Damian replied 2 weeks ago

Good answers in return of this difficulty with real arguments and explaining the whole thing regarding that.

Here is my web-site :: cbd oil (tinyurl.com)

Norma replied 2 weeks ago

Undeniably believe that which you stated. Your favorite reason seemed to be on the net the simplest thing to be aware
of. I say to you, I certainly get annoyed while people consider worries that they plainly don't know about.
You managed to hit the nail upon the top as well as defined out the whole thing without having side effect ,
people could take a signal. Will probably be back to get more.
Thanks

Here is my homepage ... cbd oil (motoalpinismo.it)

Micki replied 2 weeks ago

Hi there, yup this piece of writing is really nice and I have learned lot
of things from it concerning blogging. thanks.

Review my web site :: cbd oil, tinyurl.com,

Evangeline replied 2 weeks ago

Its like you read my mind! You seem to know a lot about
this, like you wrote the book in it or something.
I think cbd oil that works 2020 you
could do with some pics to drive the message home a little bit, but other than that, this is magnificent blog.
A fantastic read. I'll certainly be back.

Leanne replied 2 weeks ago

I used to be able to find good info from your blog posts.

my web blog ... cbd oil that works 2020

Homer replied 2 weeks ago

Great article.

Also visit my blog post :: cbd oil that works 2020

Eldon replied 2 weeks ago

Hey there! I know this is somewhat off topic
but I was wondering which blog platform are you using for
this website? I'm getting tired of Wordpress because I've had
problems with hackers and I'm looking at options for
another platform. I would be fantastic if you could point me in the direction of a good platform.

Check out my web-site; cbd oil that works 2020

1 Answers
0
前端学堂 管理员 answered 2 years ago
/**
 * 获取指定window中滚动条的偏移量,如未指定则获取当前window
 * 滚动条偏移量
 *
 * @param {window} w 需要获取滚动条偏移量的窗口
 * @return {Object} obj.x为水平滚动条偏移量,obj.y为竖直滚动条偏移量
 */
function getScrollOffset(w) {
    w =  w || window;
    // 如果是标准浏览器
    if (w.pageXOffset != null) {
        return {
            x: w.pageXOffset,
            y: w.pageYOffset
        };
    }

    // 老版本IE,根据兼容性不同访问不同元素
    var d = w.document;
    if (d.compatMode === 'CSS1Compat') {
        return {
            x: d.documentElement.scrollLeft,
            y: d.documentElement.scrollTop
        }
    }

    return {
        x: d.body.scrollLeft,
        y: d.body.scrollTop
    };
}

Your Answer

 

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏