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為負的


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM