小编Lor*_*las的帖子

Bootstrap - 打开模态,而另一个模态打开,并在体内保持'模态打开'类

当我点击另一个打开模态中的按钮时,我想打开一个新的Bootstrap模态.它工作正常,但问题是body标签的'modal-open'类只是消失了,所以会出现整个页面的滚动.

当我单击模态中的按钮时,在代码隐藏中我执行此操作:

ScriptManager.RegisterStartupScript(upMain, typeof(UpdatePanel), "Tipo descuento seleccionado", "$('#DtosModal').modal('show'); $('#tipoDtoModal').modal('hide');", true);
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能将该类保留在body标签中?

非常感谢你!

编辑:如果我改变

$(document)
   .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }) 
   .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
Run Code Online (Sandbox Code Playgroud)

在bootstrap.js中

$(document) 
   .on('show.bs.modal', '.modal', function () { document.body.className += ' modal-open'; }) 
   .on('hidden.bs.modal', '.modal', function () { document.body.className = document.body.className.replace(" modal-open", ""); })
Run Code Online (Sandbox Code Playgroud)

我解决了这个问题.还有其他更"正统"的想法吗?

twitter-bootstrap bootstrap-modal

1
推荐指数
1
解决办法
5339
查看次数

标签 统计

bootstrap-modal ×1

twitter-bootstrap ×1