jQuery實(shí)現(xiàn)淡入淡出的模態(tài)框
更新時(shí)間:2022年05月16日 15:30:12 作者:zuncle
這篇文章主要為大家詳細(xì)介紹了jQuery實(shí)現(xiàn)淡入淡出的模態(tài)框,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
本文實(shí)例為大家總結(jié)了jQuery淡入淡出模態(tài)框的使用方法,供大家參考,具體內(nèi)容如下
HTML代碼如下:固定格式就省略了
<div class="theme-popover"> <div class="theme-poptit"> <a href="#" rel="external nofollow" class="close">×</a> <h3>個(gè)人額度情況</h3> </div> <div class="theme-edu"> <p>自2017年1月1日00:00起,至2017年01月16日 24:00,您的個(gè)人額度如下:</p> <div class="theme-eduBox"> <div class="theme-eduInfo lf"> <div class="theme-eduTopLf"> <i></i> <span class="yye">本年已用額度</span> </div> <div class="theme-eduBomLf bf">0</div> </div> <div class="theme-eduInfo lf ky"> <div class="theme-eduTopLf"> <i class="able"></i> <span class="kye">本年可用額度</span> </div> <div class="theme-eduBomLf bt">20000</div> </div> </div> <h5> <a href="#" rel="external nofollow" >@快郵口岸</a> 提供技術(shù)支持 </h5> </div> </div> <--模態(tài)框背景--> <div class="theme-popover-mask"></div>
CSS代碼如下:
/*模態(tài)框*/
.theme-popover-mask {
z-index: 9998;
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:#000;
opacity:0.7;
filter:alpha(opacity=70);
display:none
}
.theme-popover {
z-index:9999;
position:fixed;
top:50%;
left:50%;
width:660px;
height:360px;
margin:-180px 0 0 -330px;
border-radius:5px;
border:solid 2px #666;
background-color:#fff;
display:none;
box-shadow: 0 0 10px #666;
}
.theme-poptit {
border-bottom:1px solid #ddd;
padding:12px;
position: relative;
font-size: 14px;
}
.theme-poptit .close {
float:right;
color:#999;
padding:5px;
margin:-2px -5px -5px;
font:bold 14px/14px simsun;
text-shadow:0 1px 0 #ddd
}
.theme-poptit .close:hover {
color:#444;
}
/*模態(tài)框內(nèi)容*/
.theme-eduBox{
width: 550px;
height: 100px;
border: 1px solid #000;
overflow: hidden;
margin: 10px auto 50px;
text-align: center;
padding: 5px 0 5px 0;
color: #000;
background: #fff;
}
.theme-edu p{
font-size: 16px;
padding: 30px 0 20px 52px;
color: #333;
}
.theme-edu h5{
font-weight: normal;
text-align: center;
}
.theme-edu h5 a{
color: #f18200;
}
.theme-eduInfo{
width: 49%;
height: 100%;
font-size: 18px;
float: left;
font-weight: bold;
border-right: 1px solid #ddd;
}
.theme-edu .ky{
border-right: 0;
}
.theme-eduTopLf{
position: relative;
width: 100%;
height: 40px;
line-height: 40px;
font-weight: normal;
}
.theme-eduTopLf i{
position: absolute;
top: 10px;
left: 56px;
width: 20px;
height: 20px;
background: url("../img/used.png") no-repeat center center/cover;
}
.theme-eduTopLf i.able{
background: url("../img/able.png") no-repeat center center/cover;
}
.theme-eduTopLf .yye,.theme-eduInfo .bf{
color: #ec4e4e;
}
.theme-eduTopLf .kye,.theme-eduInfo .bt{
color: #4CB8A8;
}
.theme-eduBomLf{
width: 100%;
height: 60px;
line-height: 60px;
font-size: 22px;
overflow: hidden;
word-wrap: break-word;JavaScript代碼如下:
jQuery(document).ready(function($) {
$('.theme-login').click(function(){
$('.theme-popover-mask').fadeIn(100);
$('.theme-popover').slideDown(200);
});
$('.theme-poptit .close').click(function(){
$('.theme-popover-mask').fadeOut(100);
$('.theme-popover').slideUp(200);
});
});
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
jQuery中使用animate自定義動(dòng)畫(huà)的方法
這篇文章主要介紹了jQuery中使用animate自定義動(dòng)畫(huà)的方法的相關(guān)資料,非常不錯(cuò)具有參考借鑒價(jià)值,需要的朋友可以參考下2016-05-05
jquery 抽獎(jiǎng)小程序?qū)崿F(xiàn)代碼
這篇文章主要介紹了jquery 抽獎(jiǎng)小程序的相關(guān)資料,這里提供了詳細(xì)的思路及實(shí)現(xiàn)代碼和實(shí)現(xiàn)效果圖,需要的朋友可以參考下2016-10-10
jQuery中innerHeight()方法用法實(shí)例
這篇文章主要介紹了jQuery中innerHeight()方法用法,實(shí)例分析了innerHeight()方法的功能、定義及獲取第一個(gè)匹配元素內(nèi)部區(qū)域高度的使用技巧,需要的朋友可以參考下2015-01-01
Juery解決tablesorter中文排序和字符范圍的方法
這篇文章主要介紹了Juery解決tablesorter中文排序和字符范圍的方法,實(shí)例分析了jQuery針對(duì)tablesorter中文排序和字符范圍的解決方法,需要的朋友可以參考下2015-05-05
jQuery實(shí)現(xiàn)動(dòng)態(tài)控制頁(yè)面元素的方法分析
這篇文章主要介紹了jQuery實(shí)現(xiàn)動(dòng)態(tài)控制頁(yè)面元素的方法,結(jié)合實(shí)例形式分析了jQuery事件響應(yīng)及頁(yè)面元素動(dòng)態(tài)操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-12-12

