jQuery實(shí)現(xiàn)的兩種簡單彈窗效果示例
本文實(shí)例講述了jQuery實(shí)現(xiàn)的兩種簡單彈窗效果。分享給大家供大家參考,具體如下:
這里利用jquery實(shí)現(xiàn)兩種彈窗效果:
1. 淡入彈窗效果:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>www.dhdzp.com 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. 滑動彈窗效果:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>www.dhdzp.com 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常見經(jīng)典特效匯總》及《jquery選擇器用法總結(jié)》
希望本文所述對大家jQuery程序設(shè)計有所幫助。
相關(guān)文章
jquery實(shí)現(xiàn)類似淘寶星星評分功能有截圖
本節(jié)主要介紹了jquery實(shí)現(xiàn)類似淘寶星星評分功能,經(jīng)測試效果相當(dāng)不錯,有圖有真相,喜歡的朋友可以參考下2014-09-09
jQuery進(jìn)階實(shí)踐之利用最優(yōu)雅的方式如何寫ajax請求
ajax請求相信對大家來說都不陌生,下面這篇文章主要介紹了jQuery進(jìn)階實(shí)踐之利用最優(yōu)雅的方式如何寫ajax請求的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。2017-12-12
jQuery實(shí)時顯示鼠標(biāo)指針位置和鍵盤ASCII碼
本文通過jquery技術(shù)實(shí)現(xiàn)鼠標(biāo)指針位置和鍵盤ASCII碼,非常具有參考借鑒價值,感興趣的朋友一起學(xué)習(xí)吧2016-03-03
jQuery獲取多種input值的簡單實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄猨Query獲取多種input值的簡單實(shí)現(xiàn)方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-06-06

