Bootstrap 3 modal fires and causes page to shift to the left momentarily / browser scroll bar problems

后端 未结 24 1528
遥遥无期
遥遥无期 2020-12-12 12:08

I am working on a site using Bootstrap 3.1.0.

You\'ll notice when the modal window opens, the browser scroll bar just disappears for a split second, then comes back.

24条回答
  •  一个人的身影
    2020-12-12 13:13

    Fixing the shifting left issue is easily done using CSS alone.

    .modal-open[style] {
    padding-right: 0px !important;
    }
    

    You're just overwriting an inline style that exists in the code. I am using mine in a WordPress build and the inline style was being applied to the body. Looked like this:

    
    

    Hope this helps someone!

提交回复
热议问题