jQuery+html5實(shí)現(xiàn)div彈出層并遮罩背景
更新時(shí)間:2015年04月15日 14:33:31 投稿:hebedich
今天在項(xiàng)目中用到了一個(gè)很好的div彈出層效果,jQuery+html5實(shí)現(xiàn)div彈出層并遮罩背景,效果非常棒,拿出來和大家一起分享!
漸入彈窗,背景變色不可點(diǎn)擊。查看效果:http://runjs.cn/detail/t08gmoij
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>popup</title>
<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
</head>
<style type="text/css">
#popup{
position: absolute;display:none; z-index:3000; background-color:#FFF; left: 601px; top: 217px; height: 150px; width: 217px;line-height:94px;text-align:center;
border: 1px solid #03F;
}
#embedding{
position: absolute; background-color: #36F; top: 94px;height:56px; width:217px;line-height:56px;text-align:center;
}
a{
text-decoration:none;
font-family:"微軟雅黑";
font-size:18px;
color:#FFF;
}
</style>
<script type="text/javascript">
$(function(){
var url = null;
$(document).on('click','button',function(){
var text = $(this).text();
switch(text){
case 'OSChina':url = 'http://www.oschina.net/';break;
case 'baidu':url = 'http://www.baidu.com/';break;
case 'CSDN':url = 'http://bbs.csdn.net/home';break;
}
$('#text').text('是否確定前往 '+text+' ?');
$('#loadingDiv').css('display','block');
$('#popup').slideDown();
});
$(document).on('click','a',function(){
if($(this).text()=='確定'){
location.href=url;
}else{
$('#loadingDiv').css('display','none');
$('#popup').slideUp();
}
});
});
</script>
<body>
<div id="loadingDiv" style="position:fixed;display:none;z-index:2000;top:0px;left:0px;width:100%;height:100%;background-color:rgba(255,255,0,0.5)"></div>
<div id="popup">
<span id="text"></span>
<div id="embedding">
<a href="javascript:void(0)">確定</a>
<a href="javascript:void(0)">取消</a>
</div>
</div>
<button style="position: absolute; left: 233px; top: 260px;" >OSChina</button>
<button style="position: absolute; left: 233px; top: 320px;" >baidu</button>
<button style="position: absolute; left: 233px; top: 380px;" >CSDN</button>
</body>
</html>
以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡。
您可能感興趣的文章:
- jQuery+CSS3+Html5實(shí)現(xiàn)彈出層效果實(shí)例代碼(附源碼下載)
- Jquery+CSS3實(shí)現(xiàn)一款簡潔大氣帶滑動(dòng)效果的彈出層
- jQuery Dialog 彈出層對(duì)話框插件
- jQuery彈出層始終垂直居中相對(duì)于屏幕或當(dāng)前窗口
- jquery實(shí)現(xiàn)居中彈出層代碼
- JQuery彈出層示例可自定義
- jQuery插件zoom實(shí)現(xiàn)圖片全屏放大彈出層特效
- JQUERY THICKBOX彈出層插件
- jQuery Mobile彈出窗、彈出層知識(shí)匯總
- jQuery點(diǎn)縮略圖彈出層顯示大圖片
- jQuery Layer彈出層傳值到父頁面的實(shí)現(xiàn)代碼
- jquery+css3實(shí)現(xiàn)的經(jīng)典彈出層效果示例
相關(guān)文章
jQuery實(shí)現(xiàn)輸入框下拉列表樹插件特效代碼分享
這篇文章主要介紹了jQuery實(shí)現(xiàn)輸入框下拉列表樹特效,推薦給大家,有需要的小伙伴可以參考下。2015-08-08
Jquery 最近瀏覽過的商品的功能實(shí)現(xiàn)代碼
Jquery 最近瀏覽過的商品的功能實(shí)現(xiàn)代碼,需要的朋友可以參考下。2010-05-05
jQuery的Cookie封裝,與PHP交互的簡單實(shí)現(xiàn)
下面小編就為大家?guī)硪黄猨Query的Cookie封裝,與PHP交互的簡單實(shí)現(xiàn)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-10-10
JQuery獲取與設(shè)置HTML元素的內(nèi)容或文本的實(shí)現(xiàn)代碼
使用JQuery可以非常容易地添加、獲取和改變某個(gè)HTML元素的內(nèi)容,你會(huì)為這種簡便感到非常愉悅2014-06-06
jquery.validate自定義驗(yàn)證用法實(shí)例分析【成功提示與擇要提示】
這篇文章主要介紹了jquery.validate自定義驗(yàn)證用法,結(jié)合實(shí)例形式分析了jQuery成功提示與擇要提示驗(yàn)證操作相關(guān)實(shí)現(xiàn)與使用技巧,需要的朋友可以參考下2020-06-06
JQuery判斷子iframe何時(shí)加載完成解決方案
需要知道iframe何時(shí)加載完成,用JQuery很簡單就能實(shí)現(xiàn),具體如下,感興趣的朋友可以參考下,希望對(duì)大家有所幫助2013-08-08

