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
Simply add a class
it worked for me
To prevent the page from shifting in similar instances - for example an accordion opening that goes past the bottom of the page - I add this in CSS:
The
overflow-y: scroll
forces the scrollbar to present at all times. To be honest, I can't remember why I putheight:100%
in there... but you don't seem to require it for this problem.Demo: http://jsfiddle.net/jxX6A/8/
There is still a little movement. But that seems to be present on Bootstrap's own example page: http://getbootstrap.com/javascript/#modals
So I'm guessing you're stuck with it... but it's still far better than what you were seeing initially.
EDIT: I might be concerned that adding these styles would interfere with other Bootstrap stuff, as I haven't used it myself, so you might want to double check on that.
I really didn't like any of the solutions provided, and used a combination of them (along with a fix I previously had for qTip modals) to come up with something that worked best for me with Bootstrap v3.3.7.
UPDATE: Resolved issue with fixed navbar positioning on iOS.
CSS:
JavaScript:
This allows the background to be "fixed" yet still allows the modals to be scrollable, resolves the issue of double scrollbar and the repositioning of the fixed navbar.
Note that there is additional code there as well to remember the 'scroll' position (and return to it) when the modal is closed.
Hope this helps anyone else looking to achieve what I was going after.
Here's the fix proposed by user yshing that really FIXED it for me while using Bootstrap
v3.1.1
and Google Chrome35.0.1916.114m
. The fix comes from a GitHub issue thread regarding this matter:The fix will land only in Bootstrap 3.2 as desbribed by mdo.
Found this answer in TB issues
just by adding this below css that small movement will be fixed
Credits to https://github.com/tvararu
i have faced same problem and following solution works for me