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
Try this:
If all the above solutions didn't work , it may be because of positioning the content ,Just take a look at the position of the modal
For anyone still struggling with this - the latest version of Bootstrap has a native fix. Just update the bootstrap.min.css and bootstrap.min.js files from the latest version.
http://getbootstrap.com/
No solution here fixed my issue. But following Css I got from Github worked for me.
This is a reported issue to bootstrap: https://github.com/twbs/bootstrap/issues/9855
And this is my temporary quick fix and it's work using fixed top navbar, only using javascript. Load this script along with your page.
Here is the working example: http://jsbin.com/oHiPIJi/64
A lot has changed since bootstrap 3.3.6 so the solutions above may not suffice.
To solve this, look at the setScrollbar function in bootstrap.js (or bootstrap-min.js of course), you will immediately notice that bootstrap is adding padding-right to the body element setting its value to a worked out value of scrollbarWidth plus existing padding-right on the body (or 0 if not).
If you comment out the below
In your css override bootstrap modal-open class with the below
Folks have suggested
overflow-y: scroll;
the problem with this is that your content shifts if scroll bar does not exists in the first place.NB As per http://getbootstrap.com/javascript/#modals, always try to place a modal's HTML code in a top-level position in your document