• 关于点击后弹出遮罩层且居中的效果


    <meta charset="UTF-8"/>
    <html>
    <head>
    <meta charset="utf-8">
    <style>
    *{
    padding:0;
    margin:0;
    }
    .lbOverlay{
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    100%;
    zoom: 1;
    background: #484848;
    z-index: 999;
    100%;
    height:100%;
    filter:alpha(opacity=50); /*IE滤镜,透明度50%*/
    -moz-opacity:0.5; /*Firefox私有,透明度50%*/
    opacity:0.5;/*其他,透明度50%*/
    }
    .hidden_pro_au {
    display:none;
    padding: 6px;
    text-align: left;
    909px;
    /*height: 600px;*/
    background: white;
    overflow: auto;
    position: absolute;
    top: 150px;
    left: 0;
    z-index: 9999999
    }
    #hidden_pro_au_top {
    border-bottom: 1px solid #999999;
    padding-bottom: 24px;
    }
    #hidden_pro_au_top h2 {
    font-family: 微软雅黑;
    font-size: 30px;
    color: #333333;
    }
    #big_bottom{
    100%;
    margin: 0 auto;
    }
    #hidden_pro_au_bottom{
    600px;
    height:auto;
    margin: 0 auto;
    }
    #hidden_pro_au_bottom_top_text,
    #hidden_pro_au_bottom_bottom_text {
    font-family: 微软雅黑;
    font-size: 14px;
    color: #666;
    }

    #hidden_pro_au_bottom_top_text,
    #hidden_pro_au_bottom_bottom_text {
    font-family: 微软雅黑;
    font-size: 14px;
    color: #666;
    }
    #hidden_pro_au_bottom_img,#hidden_pro_au_bottom_img2{
    margin-top: 44px;
    margin-bottom: 44px;
    }
    </style>
    <script src="jquery.min.js"></script>
    </head>
    <body>
    <button onclick="show_box()">入口</button>

    <div class="lbOverlay" onclick="close_hidden_pro_au()"></div>
    <div class="hidden_pro_au" style="padding-left: 42px" id="col1">
    <div id="hidden_pro_au_top">
    <h2 style="margin-top: 45px">这里是标题</h2>
    <p style="color:#999999;padding-top: 10px">首页/行业应用/工程案例/这里是标题</p>
    </div>
    <div id="big_bottom">
    <div id="hidden_pro_au_bottom">
    <div id="hidden_pro_au_bottom_top_text" style="margin-top: 45px">
    文字区域
    </div>
    <div id="hidden_pro_au_bottom_img">
    <img src="1.png" alt="" style=" 100%;height: auto"/>
    </div>
    <div id="hidden_pro_au_bottom_bottom_text">
    文字区域
    </div>
    <div id="hidden_pro_au_bottom_img2">
    <img src="1.png" alt="" style=" 100%;height: auto"/>
    </div>
    </div>
    </div>
    </div>




    </body>
    </html>

    <script>
    //动态给遮罩层高度
    total = document.documentElement.clientHeight;
    colHeight = total-100-document.getElementById("col1").offsetTop;
    document.getElementById("col1").style.height=colHeight+"px";

    //点击后显示遮罩层
    function show_box(){
    $(".lbOverlay").css({"height":window.screen.availHeight});
    $(".lbOverlay").show();

    var st=$(document).scrollTop(); //页面滑动高度
    var objH=$(".hidden_pro_au").height();//浮动对象的高度
    var ch=$(window).height();//屏幕的高度
    var objT=Number(st)+(Number(ch)-Number(objH))/4; //思路 浮动高度+((屏幕高度-对象高度))/2
    $(".hidden_pro_au").css("top",objT);

    var sl=$(document).scrollLeft(); //页面滑动左移宽度
    var objW=$(".hidden_pro_au").width();//浮动对象的宽度
    var cw=$(window).width();//屏幕的宽度
    var objL=Number(sl)+(Number(cw)-Number(objW))/2; //思路 左移浮动宽度+((屏幕宽度-对象宽度))/2
    $(".hidden_pro_au").css("left",objL);
    $(".hidden_pro_au").slideDown("20000");//这里显示方式多种效果
    }
    function close_hidden_pro_au(){
    $(".lbOverlay").hide();
    $(".hidden_pro_au").hide();
    }
    </script>



  • 相关阅读:
    调试sharepoint开发中的用户控件ascx Virus
    sharepoint中的时间问题 Virus
    使用VS进行工作流开发系列博客6Developing Workflows in VS: Part 5 Code Your Workflow Virus
    [摘抄]windows服务中的定时器timer使用 Virus
    宿主和工作流:两个世界的交互 II(工作流给Host传递数据) Virus
    sharepoint2007开发备用链接 Virus
    宿主和工作流:两个世界的交互 4(Host给工作流传递数据) Virus
    品读《建筑的永恒之道》系列 目录
    《建筑的永恒之道》相关评论汇总
    品读《建筑的用恒之道》系列 (一)大师尚在人间
  • 原文地址:https://www.cnblogs.com/heyiming/p/6042324.html
Copyright © 2020-2023  润新知