gpt4 book ai didi

javascript - 检测用户 browser-height >= page body-height

转载 作者:行者123 更新时间:2023-11-30 07:17:20 27 4
gpt4 key购买 nike

我在尝试解决这个问题时遇到了一些问题。我已经编写了一个 jquery 函数来检测用户何时点击页面底部并触发一个函数。现在,虽然这适用于最常见的屏幕尺寸,但当用户的屏幕太大以至于可以一次看到整个页面时,它就无法工作,从而使之前的功能变得无用。

我想要实现的是这些情况的回退,我如何判断用户是否有这样的屏幕尺寸来触发该功能并将其余的留给其他人?

更好的解释:如何检测用户浏览器高度是否等于或大于页面主体高度?

抱歉,如果这看起来有点困惑。

PS:以下代码是我在浏览器高度小于页面主体高度时使用的代码。

    if ($('body').height() <= ($(window).height() + $(window).scrollTop())) {
//run function here when the browser-height is smaller than
//the page's height and it has reached the bottom
}

最佳答案

    if ($(document).height() <= $(window).height() ) { }

$(文档).height();//返回 HTML 文档的高度

关于javascript - 检测用户 browser-height >= page body-height,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10130612/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com