If I open a modal dialog, through Twitter Bootstrap, I've noticed that it pushes all the html content of the page (i.e., in the container
) to the left a little bit, and then puts it back to normal after closing itself. However, this only happens if the browser width is large enough to not be on the "mobile" (i.e., smallest) media query. This occurs with the latest versions of FF and Chrome (haven't tested other browsers).
You can see the problem here: http://jsfiddle.net/jxX6A/2/
Note: You have to increase the width of the "Result" window so it switches to the "med" or "large" media query css.
I have setup the HTML of the page based upon the examples shown on Bootstrap's site:
<div class='container'>
<div class='page-header'>
<h4>My Heading</h4>
</div>
<div id='content'>
This is some content.
</div>
<div class='footer'>
<p>© 2013, me</p>
</div>
</div>
I'm guessing this is not supposed to happen, but I'm not sure what I've done wrong.
EDIT: This is a known bug, for more (and up-to-date) information, please see: https://github.com/twbs/bootstrap/issues/9855
I found the answer by Agni Pradharma working for me; however not entirely in Chrome.
It appears the document scrollbar is wider than another elements scrollbar; so I edited the getScrollBarWidth function.
It simply first checks the width; removes the document scrollbar; then compares the difference. It also happens to be much less code.
the best way is: to add to BODY
overflow-y: scroll
and remove 4 function from bootstrap.js -
It is actually caused by the following rule in bootstrap.css:
I am not exactly sure why it behaves like that (perhaps to account for scrollbar somehow) but you can change the behaviour with this:
EDIT: Actually, this is a reported issue in bootstrap: https://github.com/twbs/bootstrap/issues/9855
For me the following seems to work - tested in Firefox and Chrome on Linux:
This worked for me. Overrides the 17px padding added to the right of the body:
For me it works fine like this