自定義遮罩層 CSS+Jquery

 

   var show_div = 'MyDiv'; //遮罩divid 

                //彈出隱藏層 

              function ShowDiv() { 

                        var showdiv = document.getElementById(show_div); 

                       if (showdiv == undefined) { 

                                return

                            } 

                        showdiv.style.width = $(document).width()+"px"

                        showdiv.style.top = $("#divList").offset().top + "px"; //divList是要指定的divid,在該div上進行遮罩 

                        showdiv.style.left = $("#divList").offset().left + "px"

                    //如果要遮罩整個頁面:設置遮罩div的高:

                    showdiv.style.height= $(document).height() + "px";

                    showdiv.style.height=$(document).width() + "px";

                        //showdiv.style.height = $("#divList").height() + "px";  

                        showdiv.style.display = 'block'

                    }; 

                //關閉彈出層 

                function CloseDiv() { 

                        document.getElementById(show_div).style.display = 'none'

                    };  

        function validateInput() { 

                 ShowDiv(); 

                // __doPostBack("Button3", "");

            } 

 

 

  #MyDiv {

    background-image: url('../img/timgs.gif');

    background-repeat:no-repeat;

    background-size:100%;

    }

    .white_content

            display: none

           position: absolute

           border: 3px solid lightblue

           background-color: #CAE4F7

            z-index: 9999

           -moz-opacity: 0.5

            opacity: .50

            filter: alpha(opacity=50)

            vertical-align: middle

           top:0px

           text-align:center

        } 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章