美文网首页
判断页面滚动

判断页面滚动

作者: 塔塔七 | 来源:发表于2020-09-29 16:47 被阅读0次
window.onscroll = function () {
        var t = document.documentElement.scrollTop || document.body.scrollTop;
        if (t > 50) {
          $api.css(
            $api.byId("header"),
            "background-color: rgba(29, 205, 184, 0.5)"
          );
          $api.css(
            $api.byId("nav"),
            "background-color: rgba(29, 205, 184, 0.1)"
          );
        } else {
          $api.css($api.byId("header"), "background-color: transparent");
          $api.css($api.byId("nav"), "background-color: transparent");
        }
      };

相关文章

网友评论

      本文标题:判断页面滚动

      本文链接:https://www.haomeiwen.com/subject/gaveuktx.html