jQuery實(shí)現(xiàn)的兩種簡(jiǎn)單彈窗效果示例
本文實(shí)例講述了jQuery實(shí)現(xiàn)的兩種簡(jiǎn)單彈窗效果。分享給大家供大家參考,具體如下:
這里利用jquery實(shí)現(xiàn)兩種彈窗效果:
1. 淡入彈窗效果:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>www.dbjr.com.cn jQuery彈窗</title>
<style>
*{padding: 0;margin: 0;}
.box{width: 100%;height: 100%;}
.main{width: 100%;height: 100%;background-color: rgba(0,0,0,0.8);display: none;position: fixed;z-index: 1;}
.mainbox{width: 800px;height: 100%;margin: 0 auto;background-color: rgba(255,255,255,0.8);padding: 20px;}
.kkk{width: 100%;height: 1200px;background-color: red;}
.close{color: red;cursor: pointer;}
</style>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function(){
$(".btn").click(function(){
$(".main").fadeIn();
});
$(".close").click(function(){
$(".main").fadeOut();
});
});
</script>
</head>
<body>
<div class="main">
<div class="mainbox">
<div class="close">點(diǎn)擊關(guān)閉</div>
</div>
</div>
<div class="box">
<div class="kkk">
<input class="btn" type="button" value="點(diǎn)擊淡入彈窗" />
</div>
</div>
</body>
</html>
運(yùn)行效果:

2. 滑動(dòng)彈窗效果:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>www.dbjr.com.cn jQuery彈窗</title>
<style>
*{padding: 0;margin: 0;}
.box{width: 100%;height: 100%;}
.main{width: 100%;height: 100%;background-color: rgba(0,0,0,0.8);display: none;position: fixed;z-index: 1;}
.mainbox{width: 800px;height: 100%;margin: 0 auto;background-color: rgba(255,255,255,0.8);padding: 20px;display: none;}
.kkk{width: 100%;height: 1200px;background-color: red;}
.close{color: red;cursor: pointer;}
</style>
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
<script>
$(function(){
$(".btn").click(function(){
$(".main").fadeIn();
$(".mainbox").delay(500).slideDown();
});
$(".close").click(function(){
$(".main").fadeOut();
});
});
</script>
</head>
<body>
<div class="main">
<div class="mainbox">
<div class="close">點(diǎn)擊關(guān)閉</div>
</div>
</div>
<div class="box">
<div class="kkk">
<input class="btn" type="button" value="點(diǎn)擊淡入彈窗" />
</div>
</div>
</body>
</html>
運(yùn)行效果:

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery窗口操作技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常用插件及用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery常見(jiàn)經(jīng)典特效匯總》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
相關(guān)文章
當(dāng)jquery ajax遇上401請(qǐng)求的解決方法
下面小編就為大家?guī)?lái)一篇當(dāng)jquery ajax遇上401請(qǐng)求的解決方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05
使用CSS和jQuery模擬select并附提交后取得數(shù)據(jù)的代碼
使用CSS和jQuery模擬select并實(shí)現(xiàn)提交后取得數(shù)據(jù),詳細(xì)實(shí)現(xiàn)及截圖如下,感興趣的朋友可以參考下2013-10-10
關(guān)于jquery性能最佳實(shí)踐的討論,與求教
很久沒(méi)寫東西,年前的項(xiàng)目也接近尾聲,最近在網(wǎng)上看到一篇文章是 阮一峰 的 《jQuery最佳實(shí)踐》 鏈接在文末2012-03-03
jquery插件jquery.beforeafter.js實(shí)現(xiàn)左右拖拽分隔條對(duì)比圖片的方法
這篇文章主要介紹了jquery插件jquery.beforeafter.js實(shí)現(xiàn)左右拖拽分隔條對(duì)比圖片的方法,可實(shí)現(xiàn)圖片拖拽變換的功能,需要的朋友可以參考下2015-08-08
jQuery基礎(chǔ)知識(shí)點(diǎn)總結(jié)(必看)
下面小編就為大家?guī)?lái)一篇jQuery基礎(chǔ)知識(shí)點(diǎn)總結(jié)(必看)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05
jquery實(shí)現(xiàn)的超出屏幕時(shí)把固定層變?yōu)槎ㄎ粚拥拇a
相信很多人都上過(guò)taobao吧,在taobao的產(chǎn)品列表頁(yè)有一個(gè)浮動(dòng)的用來(lái)排序的浮動(dòng)層,當(dāng)你拖動(dòng)滾動(dòng)條而導(dǎo)致那個(gè)排序欄看不到的時(shí)候它會(huì)自動(dòng)變?yōu)楦?dòng)層,一直固定在那里。2010-02-02
jQuery實(shí)現(xiàn)的向下圖文信息滾動(dòng)效果
jquery實(shí)現(xiàn)的圖文滾動(dòng)效果,圖文內(nèi)容經(jīng)過(guò)指定的間隔時(shí)間自動(dòng)向下滾動(dòng)顯示,效果非常酷。有需要的小伙伴可以參考下。2015-05-05

