当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery实现淡入淡出的模态框

jQuery实现淡入淡出的模态框

2019年03月26日  | 移动技术网IT编程  | 我要评论
本文实例为大家总结了jquery淡入淡出模态框的使用方法,供大家参考,具体内容如下 html代码如下:固定格式就省略了 <div class="theme

本文实例为大家总结了jquery淡入淡出模态框的使用方法,供大家参考,具体内容如下

html代码如下:固定格式就省略了

<div class="theme-popover">
 <div class="theme-poptit">
  <a href="#" rel="external nofollow" class="close">×</a>
  <h3>个人额度情况</h3>
 </div>
 <div class="theme-edu">
  <p>自2017年1月1日00:00起,至2017年01月16日 24:00,您的个人额度如下:</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>
   提供技术支持
  </h5>
 </div>
</div>
<--模态框背景-->
<div class="theme-popover-mask"></div>

css代码如下:

/*模态框*/
.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;
}
/*模态框内容*/
.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);
 });
});

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网