js實(shí)現(xiàn)彈窗暗層效果
更新時間:2017年01月16日 09:15:51 作者:13611606223
本文主要分享了js實(shí)現(xiàn)彈窗暗層效果的示例代碼。具有一定的參考價值,下面跟著小編一起來看下吧
話不多說,請看示例代碼:
<!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>活動細(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)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持腳本之家!
相關(guān)文章
JS實(shí)現(xiàn)網(wǎng)頁滾動條感應(yīng)鼠標(biāo)變色的方法
這篇文章主要介紹了JS實(shí)現(xiàn)網(wǎng)頁滾動條感應(yīng)鼠標(biāo)變色的方法,實(shí)例分析了javascript針對鼠標(biāo)事件的操作技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-02-02
JavaScript 基礎(chǔ)表單驗(yàn)證示例(純Js實(shí)現(xiàn))
下面小編就為大家?guī)硪黄狫avaScript 基礎(chǔ)表單驗(yàn)證示例(純Js實(shí)現(xiàn))。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-07-07
js實(shí)現(xiàn)瀏覽器窗口大小被改變時觸發(fā)事件的方法
這篇文章主要介紹了js實(shí)現(xiàn)瀏覽器窗口大小被改變時觸發(fā)事件的方法,實(shí)例分析了window.onresize方法的使用技巧,需要的朋友可以參考下2015-02-02
JS實(shí)現(xiàn)二維數(shù)組橫縱列轉(zhuǎn)置的方法
下面小編就為大家分享一篇JS實(shí)現(xiàn)二維數(shù)組橫縱列轉(zhuǎn)置的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-04-04

