bootstrap打开模态modal窗口引起页面抖动解决办法

在使用bootstrap的modal模态窗口组件时,触发后会发现页面有抖动现象。这是因为它隐藏了浏览器滚动条,页面就相当于变宽了,关闭模态窗口后,页面又出现滚动条,页面又变窄了,这一伸一缩就会使页面产生抖动现象。我的解决方法很简单,就是干掉隐藏滚动条的代码。

解决方法:修改style.css

body.modal-open {
    overflow-y: auto !important;        
    padding-right: 0 !important;
}
body { 
    padding-right: 0 !important; 
} 

相关链接:

https://blog.csdn.net/weixin_40648180/article/details/80610963

https://blog.csdn.net/pig_999/article/details/99693190

原文地址:https://www.cnblogs.com/Steven5007/p/12515693.html