Bootstrap Modals keep adding padding-right to body after closed

后端 未结 30 1940
南方客
南方客 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

    I had this same problem for a VERY long time. None of the answers here worked! But the following fixed it!

    $(document.body).on('hide.bs.modal,hidden.bs.modal', function () {
        $('body').css('padding-right','0');
    });
    

    There are two events that fire on closing of a modal, first it's hide.bs.modal, and then it's hidden.bs.modal. You should be able to use just one.

提交回复
热议问题