国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

簡單的Jquery遮罩層代碼實例

2019-11-20 21:41:59
字體:
供稿:網(wǎng)友

Css代碼

復(fù)制代碼 代碼如下:

 #brg
{
 width: 100%;
 height: 100%;
 background: #333;
 position: absolute;
 top: 0;
 left: 0;
 filter: alpha(opacity=60);
 -moz-opacity: 0.6;
 opacity: 0.6;
 position: absolute;
 top: 0;
 left: 0;
 display: none;
}
#showdiv
{
 width: 100%;
 height: auto;
 position: absolute;
 left: 300px;
 top: 150px;
 z-index: 330;
 display: none;
}
#testdiv
{
 width: 800px;
 height: auto;
 margin: 0 0;
 border: 1px solid #4d4d4d;
 background: #f2f2f2;
}
#close
{
 width: 200px;
 height: 27px;
 line-height: 27px;
 font-size: 14px;
 font-weight: bold;
 border: 1px solid #4d4d4d;
 text-align: center;
 cursor: pointer;
 margin: 0 auto;
 background: #333;
 color: #fff;
}

Html 代碼

復(fù)制代碼 代碼如下:

 <div id="brg">
    </div>
    <div id="showdiv">
        <div id="close">
            關(guān)閉
        </div>
        <div id="testdiv">


  要顯示的內(nèi)容

        </div>
    </div>

Jquery 代碼

復(fù)制代碼 代碼如下:

 $(document).ready(function() {
            var bheight = document.body.clientHeight;
            $("#btnAdd").click(function() {
                $("#brg").css("display", "block");
                $("#showdiv").css("display", "block");
                $("#brg").css("height", document.body.scrollHeight);
                $("#showdiv").css("top", document.body.scrollTop + 100);
            });
            $("#close").click(function() {
                $("#brg").css("display", "none");
                $("#showdiv").css("display", "none");
            });
        });

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 乌审旗| 家居| 盱眙县| 万山特区| 巴塘县| 岳池县| 贡觉县| 刚察县| 盐边县| 绥芬河市| 永昌县| 宜昌市| 甘孜县| 临安市| 桂阳县| 沧源| 荥阳市| 灌南县| 娄烦县| 灵寿县| 汨罗市| 科尔| 永泰县| 池州市| 雷山县| 小金县| 静宁县| 葵青区| 东辽县| 西乡县| 台东县| 安义县| 乐业县| 原阳县| 五峰| 永川市| 湘潭市| 乌苏市| 肇庆市| 潮州市| 阳信县|