Javascript:检查IF页面是否在顶部 [英] Javascript: check IF page is at top

查看:98
本文介绍了Javascript:检查IF页面是否在顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法用javascript检查页面是否在滚动(0,0)

Is there a way to check, with javascript, if the page is at scroll(0,0)?

原因是我有一个完整页面滑块,我需要暂停第二页页面不在原点。

Reason being I've got a full page slider that I need to pause the second the page is not at origin.

它可能不一定是因为页面正在滚动,因为我有内部HTML#链接,可以将页面加载到滚动点而不实际滚动。

And it might not necessarily be because the page is being scrolled live as I've got internal HTML # links that would load the page right to a scrolled point without actually scrolling.

因此检查需要的是页面不在顶部,而不是页面已滚动。

So the check needs to be is the page not at the top, as opposed to, has the page been scrolled.

推荐答案

试试这个:

document.body.scrollTop === 0

这篇关于Javascript:检查IF页面是否在顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆