Bootstrap Modal遮罩弹出层代码分享
下面这段代码并非是Bootstrap的遮罩,只是简单版的遮罩效果,Bootstrap那个太啰嗦了。如果你钟情Bootstrap的那个遮罩,来看看这篇文章“完全版:Bootstrap弹出层遮罩”。
<divclass="theme-popover"> <divclass="theme-poptit"> <ahref="javascript:void(0);"title="关闭"class="close">×</a> <h3>登录是一种态度</h3> </div> <divclass="theme-popboddform"> <formclass="theme-signin"name="loginform"action=""method="post"> <ol> <li><h4>你必须先登录!</h4></li> <li><strong>用户名:</strong><inputclass="ipt"type="text"name="log"value="lanrenzhijia"size="20"/></li> <li><strong>密码:</strong><inputclass="ipt"type="password"name="pwd"value="***"size="20"/></li> <li><inputclass="btnbtn-primary"type="submit"name="submit"value="登录"/></li> </ol> </form> </div> </div> <divclass="theme-popover-mask"></div>
via重要的CSS,里面的内容样式可以根据自己需求修改:原文来自:https://www.nhooo.com/article/97841.htm
//codefromhttp://caibaojian.com/bootstrap-modal.html
.theme-popover-mask{
z-index:9998;
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:#000;
opacity:0.4;
filter:alpha(opacity=40);
display:none
}
.theme-popover{
z-index:9999;
position:fixed;
top:50%;
left:50%;
width:660px;
height:360px;
margin:-180px00-330px;
border-radius:5px;
border:solid2px#666;
background-color:#fff;
display:none;
box-shadow:0010px#666;
}
jQuery代码,点击出现,点击右上角关闭
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);
})
})
以上所述是小编给大家介绍的BootstrapModal遮罩弹出层代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!