网站任何显示器全屏显示

    xiaoxiao2025-04-11  13

    网站任何显示器全屏显示

        现在很多公司在内容区域不大的情况下喜欢在浏览器上全屏显示。而且在不同分辨率下都要实现。

        开始以为每个浏览器都要做一款CSS样式。但是成本太高,所以就要引用JS。

         首先可以在网站中放一个img 然后把它绝对定位,然后没10毫秒改变一下这个图片的大小就可以了,这样这张图片就可以在任何显示器上全屏显示。

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>建设中</title> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> <style> html{ height:100%;} body{font-size:14px;font-family:"微软雅黑",calluna, Georgia, serif,'proxima-nova', 'Helvetica Neue', Helvetica, sans-serif; overflow:hidden; height:100%; } #wrapImg{position: absolute; top: 0px; left: 0px;overflow: hidden; bottom:0px; right:0px; z-index:-10;} </style> </head> <body>     <div>             <img id="wrapImg" src="images/LOGO_JS.jpg" οnclick="javascript:art.dialog.close();">     </div>

        <div class="top"></div>

        <div class="content"></div>

        <div class="bottom"></div>     <script type="text/javascript">              $(function(){//窗口位置         setInterval(function(){             var ww = $(window).width(),//浏览器宽                 wh = $(window).height();         $("#wrapImg").width(ww).height(wh);         },10)     })          </script> </body> </html>

       至于里面的内容区只要内容不超出显示器的宽度就可以了,超出就要产生overflow-Y 的滚动条。

    注意 : 不要给BODY设置高度。。要不会超出部分产生白底出来。。

    转载请注明原文地址: https://ju.6miu.com/read-1297962.html
    最新回复(0)