DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> WEB網站前端 >> 網頁特效代碼 >> jquery+CSS3遮罩彈出層提示框可關閉
jquery+CSS3遮罩彈出層提示框可關閉
編輯:網頁特效代碼     
jquery CSS3遮罩彈出層動畫效果,使用非常簡單,就兩個標簽,裡面自定義內容和樣式,四種常見效果,懂的朋友還可以修改源代碼修改成自己想要的效果

效果展示

代碼如下:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>JQuery-CSS3制作簡潔的彈框_何問起</title>
<script type="text/javascript" src="http://down.hovertree.com/jquery/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="http://hovertree.com/texiao/jquery/85/style.css">
<style>.hovertreeinfo{text-align:center;}.hovertreeinfo a{color:blue}</style>
</head>

<body>
<div class="hovertreeinfo"><h2>jquery CSS3制作簡潔遮罩彈出層動畫</h2>
幾種常見的簡潔彈框</div>
<div class="checkbox">
<a href="javascript:0;" class="cd-popup-trigger0">樣式1</a>
<a href="javascript:0;" class="cd-popup-trigger1">樣式2</a>
<a href="javascript:0;" class="cd-popup-trigger2">樣式3</a>
<a href="javascript:0;" class="cd-popup-trigger3">樣式4</a>
</div>
<!--彈框-->
<div class="cd-popup">
<div class="cd-popup-container">
<p>何問起</p>
<div class="cd-buttons">
1 自定義整體容器寬高度及內容,高度可自適應可固定,樣式可以定義自己喜歡的樣式,這裡就不做美觀了
</div>
<a href="javascript:;" class="cd-popup-close">close</a>
</div>
</div>

<div class="cd-popup1">
<div class="cd-popup-container1">
<p>何問起</p>
<div class="cd-buttons">
2 自定義整體容器寬高度及內容,高度可自適應可固定,樣式可以定義自己喜歡的樣式,這裡就不做美觀了,更多特效:<a href="http://hovertree.com/texiao/" target="_blank">http://hovertree.com/texiao/</a>
</div>
<a href="javascript:;" class="cd-popup-close">close</a>
</div>
</div>

<div class="cd-popup2">
<div class="cd-popup-container2">
<p>何問起</p>
<div class="cd-buttons">
3 自定義整體容器寬高度及內容,高度可自適應可固定,樣式可以定義自己喜歡的樣式,這裡就不做美觀了
</div>
<a href="javascript:;" class="cd-popup-close">close</a>
</div>
</div>

<div class="cd-popup3">
<div class="cd-popup-container3">
<p>何問起</p>
<div class="cd-buttons">
4 自定義整體容器寬高度及內容,高度可自適應可固定,樣式可以定義自己喜歡的樣式,這裡就不做美觀了
</div>
<a href="javascript:;" class="cd-popup-close">close</a>
</div>
</div>

<div class="hovertreeinfo"><a href="http://hovertree.com" target="_blank">何問起</a>
<a href="http://hovertree.com/menu/texiao/" target="_blank">網頁特效</a>
<a href="http://hovertree.com/h/bjaf/0ai05muy.htm" target="_blank">代碼說明</a></div>
<script type="text/javascript">
/*彈框JS內容*/
jQuery(document).ready(function($){
//打開窗口
$('.cd-popup-trigger0').on('click', function(event){
event.preventDefault();
$('.cd-popup').addClass('is-visible');
//$(".dialog-addquxiao").hide()
});
//關閉窗口
$('.cd-popup').on('click', function(event){
if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup') ) {
event.preventDefault();
$(this).removeClass('is-visible');
}
});
//ESC關閉
$(document).keyup(function(event){
if(event.which=='27'){
$('.cd-popup').removeClass('is-visible');
}
});

//打開窗口
$('.cd-popup-trigger1').on('click', function(event){
event.preventDefault();
$('.cd-popup1').addClass('is-visible1');
//$(".dialog-addquxiao").hide()
});
//關閉窗口
$('.cd-popup1').on('click', function(event){
if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup1') ) {
event.preventDefault();
$(this).removeClass('is-visible1');
}
});
//ESC關閉
$(document).keyup(function(event){
if(event.which=='27'){
$('.cd-popup1').removeClass('is-visible1');
}
});

//打開窗口 by 何問起
$('.cd-popup-trigger2').on('click', function(event){
event.preventDefault();
$('.cd-popup2').addClass('is-visible2');
//$(".dialog-addquxiao").hide()
});
//關閉窗口
$('.cd-popup2').on('click', function(event){
if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup2') ) {
event.preventDefault();
$(this).removeClass('is-visible2');
}
});
//ESC關閉
$(document).keyup(function(event){
if(event.which=='27'){
$('.cd-popup2').removeClass('is-visible2');
}
});

//打開窗口
$('.cd-popup-trigger3').on('click', function(event){
event.preventDefault();
$('.cd-popup3').addClass('is-visible3');
//$(".dialog-addquxiao").hide()
});
//關閉窗口
$('.cd-popup3').on('click', function(event){
if( $(event.target).is('.cd-popup-close') || $(event.target).is('.cd-popup3') ) {
event.preventDefault();
$(this).removeClass('is-visible3');
}
});
//ESC關閉
$(document).keyup(function(event){
if(event.which=='27'){
$('.cd-popup3').removeClass('is-visible3');
}
});
});
</script>
</body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved