Bootstrap Modals keep adding padding-right to body after closed

后端 未结 30 2001
南方客
南方客 2020-12-12 12:36

I am using bootstrap and Parse framework to build a small webapp. But those Bootstrap modals keep adding padding-right to body after closed. How to solve this?

I tri

30条回答
  •  醉话见心
    2020-12-12 12:56

    Bootstrap models add that padding-right to the body if the body is overflowing.

    On bootstrap 3.3.6 (the version I'm using) this is the function responsible for adding that padding-right to the body element: https://github.com/twbs/bootstrap/blob/v3.3.6/dist/js/bootstrap.js#L1180

    A quick workaround is to simply overwrite that function after calling the bootstrap.js file:

    $.fn.modal.Constructor.prototype.setScrollbar = function () { };
    

    This fixed the issue for me.

提交回复
热议问题