检测用户浏览器高度是否>=页面正文高度

Detect if user browser-height >= page body-height

本文关键字:高度 正文 用户 浏览器 是否 检测      更新时间:2023-09-26

我在这里遇到了一些问题,试图弄清楚这个问题。我已经编写了一个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() ) { }

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

改用文档高度。

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