js實(shí)現(xiàn)彈窗暗層效果
話不多說,請(qǐng)看示例代碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" >
<link rel="stylesheet" href="styles/lianxi.css">
<script src="http://r01.uzaicdn.com/content/v1/scripts/core.js"></script>
<script src="scripts/lianxi.js"></script>
<!--[if lt IE 9]><script src="http://r.uzaicdn.com/content/libs/html5shiv.js"></script><![endif]-->
<!--[if IE 6]><script src="http://r.uzaicdn.com/content/libs/dd_belatedpng_0.0.8a-min.js" type="text/javascript"></script><script>DD_belatedPNG.fix('.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>活動(dòng)細(xì)則</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>
以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時(shí)也希望多多支持腳本之家!
相關(guān)文章
JS實(shí)現(xiàn)根據(jù)出生年月計(jì)算年齡
本篇文章主要是對(duì)利用JS實(shí)現(xiàn)根據(jù)出生年月計(jì)算年齡的示例代碼進(jìn)行了介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2014-01-01
JS鏈?zhǔn)秸{(diào)用的實(shí)現(xiàn)方法
程序開發(fā)人員可以使用一些簡單的技術(shù)來改進(jìn)自己的代碼編寫工作。你可以寫一些函數(shù)來處理各種常見任務(wù),以節(jié)省時(shí)間;也可以改進(jìn)一下代碼的實(shí)現(xiàn)方式,比如你可以把方法的鏈?zhǔn)秸{(diào)用技術(shù)用到自己所寫的JS庫中,把自己喜歡的方法串起來調(diào)用。2013-03-03
echarts折線圖實(shí)現(xiàn)部分虛線部分實(shí)線效果的方法
在折線圖中,通常實(shí)線表示實(shí)際數(shù)據(jù),而虛線用于表示預(yù)測(cè)數(shù)據(jù),這篇文章主要介紹了echarts折線圖實(shí)現(xiàn)部分虛線部分實(shí)線效果的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下2024-09-09
JS實(shí)現(xiàn)網(wǎng)頁背景顏色與select框中顏色同時(shí)變化的方法
這篇文章主要介紹了JS實(shí)現(xiàn)網(wǎng)頁背景顏色與select框中顏色同時(shí)變化的方法,實(shí)例分析了javascript操作select及css樣式的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-02-02
微信小程序scroll-view實(shí)現(xiàn)滾動(dòng)穿透和阻止?jié)L動(dòng)的方法
這篇文章主要介紹了微信小程序scroll-view實(shí)現(xiàn)滾動(dòng)穿透和阻止?jié)L動(dòng)的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-08-08
Three.Js實(shí)現(xiàn)顏色自定義變換效果實(shí)例
這篇文章主要給大家介紹了關(guān)于Three.Js實(shí)現(xiàn)顏色自定義變換效果的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2023-02-02

