bootstrap-modal - bootstrap中的madal咋么放在js中
本文介绍了bootstrap-modal - bootstrap中的madal咋么放在js中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
bootstrap中的madal咋么放在js中
解决方案
$modal = $alert = $('<div class="modal fade alert-modal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">\
<div class="modal-dialog modal-sm" style="width:700px;">\
<div class="modal-content alert-modal-content" style="top:40%;margin-top:-103px;background-color:#f3f3f3;">\
<div style="padding:20px 0 19px;font-size:21px;color:#c2c0be;" class="tc f20 fcg f16">Notice</div>\
<img src="/images/scenic_chacha.png" style="top:21px;right:17px;opacity:0.6;" class="cp pa alert_img_close">\
<div class="message_alert f16 fcg" style="margin-left:31px;padding:41px 45px 0;width:636px;height:136px;border:1px solid #eee;border-radius:3px;background-color:white;">'+msg+'</div>\
<button class="alert_button" style="margin:35px 31px 40px 0;width:185px;height:50px;border-radius:3px;font-size:20px;">OK</button>\
<div class="cb"></div>\
</div>\
</div>\
</div>');
$('body').append($modal);
$modal.modal('show');
1 将HTML转换成字符串,字符串换行的时候记得使用转义符 "";
2 将字符串插入到某个容器中;
3 调用.show()
这篇关于bootstrap-modal - bootstrap中的madal咋么放在js中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文