最近的项目有留言板弹出对话框,然后我就自己写了一个静态的,下面就直接上代码:
<p class="fade"></p> <p class="succ-pop"> <h2 class="title"> 这里是要填写的内容 </h2> </p>
/*灰色遮罩层*/
.fade {
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
position: fixed;
left: 0;
top: 0;
z-index: 2;
}
/*弹出层*/
.succ-pop {
width: 400px;
height: 300px;
background: #fff;
position: fixed;/*这里的定位可以根据自己喜好选择absolute或者fixed*/
left: 50%;
top: 50%;/*这里的top根据自己的需要定*/
margin-left: -200px;
margin-top: -150px;
z-index: 3;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.succ-pop h2.title {
text-align: center;
color: lightskyblue;
}如果你不希望有弹框的时候页面还会滚动,那就加上$('body').css('overflow-y','hidden');就可以了。
总结:
Copyright © 2019- gamedaodao.com 版权所有 湘ICP备2022005869号-6
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务