div样式position:fixed,不随屏幕滚动而滚动,导致屏幕太小时弹出层被遮挡,无法滚动查看的解决办法

  window.onscroll = function () {
            var sl = -Math.max(document.body.scrollTop, document.documentElement.scrollTop);
            //document.getElementsByClassName('layui-m-layerchild').style.Top = sl + 'px';
            $("#fixdiv").css("top", sl + "px");

        };

根据计算屏幕滚动时距顶部的距离,设置弹出层top为负的

posted @ 2017-12-06 10:46  过一天日子修一天缘  阅读(2761)  评论(0编辑  收藏  举报