覆盖现有的jQuery窗口刷新

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了覆盖现有的jQuery窗口刷新相关的知识,希望对你有一定的参考价值。

我目前正在一个网站上工作,我无法编辑页面模板。在此模板中,以下jQuery用于在调整大小时刷新页面:

var lastWindowWidth = $(window).width();
$(window).resize(function () {
    setTimeout(function () {
        if ($(window).width() !== lastWindowWidth) {
            window.location.href = window.location.href;
        }
    }, 200);
});

有什么方法可以使用javascript或jQuery关闭或覆盖它?

答案

我想可能是

$(window).off("resize");

这表明resize可以配置off https://api.jquery.com/resize/

http://api.jquery.com/off/

以上是关于覆盖现有的jQuery窗口刷新的主要内容,如果未能解决你的问题,请参考以下文章