多个引导模态的滚动问题 [英] Scrolling issues with multiple bootstrap modals
问题描述
我有一个带有大量信息的模态的页面,所以你需要滚动。此模态包含指向第二个模态的链接。
I have a page with a modal with a lot of info so you need to scroll. This modal contains a link to a second modal.
当我
- 打开模态1
- 点击链接打开模态2(模态1保持在后台)
- 然后关闭模态2以便我回到模态1
模态1失去滚动(仍然有滚动条,但它没有做任何事情)。相反,模态保持在打开模态2时的位置。
modal 1 looses scrolling (there is still a scroll bar but it doesn't do anything). Instead the modal stays in the position it was at the time of opening modal 2.
我首先使用js关闭背景模态(但是这会让人感到困惑)第二种模式)。似乎每当我尝试打开/关闭多个模态时,我总是会遇到滚动问题。
I played around with closing the background modal with js first (but that messes up scrolling on the second modal). It appears that every time I try to open/close more than one modal I always get some issue with the scrolling.
有关如何处理此事的任何建议吗?
Any suggestions on how to handle this?
推荐答案
添加
.modal { overflow: auto !important; }
到你的 CCS
。
如果没有您的代码我继续创建了这个 jsFiddle 重现你的问题,或者至少是一个非常相似的问题。添加你的代码,我将测试它是否有效。
Without your code I went ahead and created this jsFiddle that recreates your issue, or at least a very similar one. Add your code and I will test if this works or not.
将该行添加到CSS修复了问题,如此 jsFiddle 。
Adding that line to the CSS fixed the issue as demonstrated with this jsFiddle.
解决方案取自这个主题在github上提供了其他解决方案。
Solution taken from this thread on github which offers other solutions as well.
这篇关于多个引导模态的滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!