這篇文章給大家分享的是有關(guān)js如何實現(xiàn)彈窗暗層效果的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供安順網(wǎng)站建設(shè)、安順做網(wǎng)站、安順網(wǎng)站設(shè)計、安順網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、安順企業(yè)網(wǎng)站模板建站服務(wù),十年安順做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。
示例代碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="http://r01.uzaicdn.com/content/v1/styles/subject.css">
<link rel="stylesheet" href="styles/lianxi.css">
<script src="/upload/otherpic63/78000.png');</script><![endif]-->
<style type='text/css'>
.fn-mask{width: 100%;height: 100%;background: #000;opacity: 0.5;position: fixed;left: 0;top: 0;transition:all 0.5s ease 0s;z-index: 998;}
button{margin:0 auto;display: block;margin-top: 300px;background: pink;}
.main{width: 100px;height: 100px;background: #fff;position: fixed;left: 50%;top: 50%;z-index: 1000;text-align: center;line-height: 100px;}
.main i{color: red;font-size: 36px;position: absolute;top:-30px;right: 0;cursor: pointer;}
</style>
</head>
<body>
<div class="box">
<button>活動細則</button>
<div class="fn-mask hide"></div>
<div class="main hide">
你好,我是彈窗
<i>x</i>
</div>
</div>
</body>
<script>
$(function(){
$('button').on('click',function(){
$('.fn-mask').removeClass('hide');
$('.main').removeClass('hide');
})
$('.main i').on('click',function(){
$('.fn-mask').addClass('hide');
$('.main').addClass('hide');
})
})
</script>
</html>感謝各位的閱讀!關(guān)于“js如何實現(xiàn)彈窗暗層效果”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
網(wǎng)站名稱:js如何實現(xiàn)彈窗暗層效果
文章出自:http://chinadenli.net/article48/jigphp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)站設(shè)計公司、企業(yè)建站、品牌網(wǎng)站制作、關(guān)鍵詞優(yōu)化、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)