您的位置:首页 > Web前端 > BootStrap

bootstrap 模态框动态加载数据

2016-12-23 14:12 357 查看
1.页面中添加modal

<!-- 模态框(Modal) -->
<div class="modal fade" id="showModal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width:900px;">
<div class="modal-content">
//内容动态填充
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
2.数据格式。页面动态生成a 标签
<a data-toggle='modal'   data-target='#showModal' onclick=targetto('"  + row.id + "')>"+ row.title+"</a>";

3.单击事件
function targetto(id){
$("#showModal").modal({
remote: "showAction.action?id="+id
});
}

4.每次隐藏时,清除数据。确保点击时,重新加载
$("#showModal").on("hidden.bs.modal", function() {
$(this).removeData("bs.modal");
});
5.基于bootstrap3.其他版本,请自己Google,如有雷同,纯属巧合,如有需要,欢迎分享。


原文:http://blog.csdn.net/shenyingkui/article/details/45693129
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: