This repository has been archived by the owner. It is now read-only.
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upfix(modal): Fix background move a little when opening a modal #3144
Conversation
src/modal/modal.js
Outdated
| var bodyPad = 0; | ||
| var scrollBarWidth = 0; | ||
| var body = $document.find('body').eq(0); | ||
| var fixedElements = angular.element($document[0].querySelector('.navbar-fixed-top, .navbar-fixed-bottom, .affix')); |
This comment has been minimized.
This comment has been minimized.
wesleycho
Mar 31, 2015
Member
Use
var fixedElements = angular.element(body.querySelector('.navbar-fixed-top, .navbar-fixed-bottom, .affix'));
src/modal/modal.js
Outdated
| @@ -139,6 +139,10 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) | |||
| var backdropDomEl, backdropScope; | |||
| var openedWindows = $$stackedMap.createNew(); | |||
| var $modalStack = {}; | |||
| var bodyPad = 0; | |||
| var scrollBarWidth = 0; | |||
| var body = $document.find('body').eq(0); | |||
This comment has been minimized.
This comment has been minimized.
src/modal/modal.js
Outdated
| if (backdropScope) { | ||
| backdropScope.index = newBackdropIndex; | ||
| } | ||
| }); | ||
|
|
||
| function removeModalWindow(modalInstance) { | ||
| function checkScrollBar() { | ||
| if ($document[0].body.clientWidth >= window.innerWidth ) { return; } |
This comment has been minimized.
This comment has been minimized.
src/modal/modal.js
Outdated
| } | ||
|
|
||
| function measureScrollBar() { | ||
| scrollBarWidth = window.innerWidth - $document[0].body.clientWidth; |
This comment has been minimized.
This comment has been minimized.
|
Can you create a Plunker illustrating this in action? |
src/modal/modal.js
Outdated
| @@ -266,6 +290,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.transition']) | |||
| openedWindows.top().value.modalDomEl = modalDomEl; | |||
| body.append(modalDomEl); | |||
| body.addClass(OPENED_MODAL_CLASS); | |||
|
|
|||
| if (scrollBarWidth) { setScrollBar(); } | |||
This comment has been minimized.
This comment has been minimized.
arma-gast
Jul 27, 2015
You should check if backdrop index is zero here. If you open modal, while another modal is open, it will shift body and fixed elements for another scrollbar width.
TilmannBach
commented
Sep 1, 2015
|
whats the status on this pr? |
054ed91
to
3e699b2
sifo
added a commit
to sifo/bootstrap-bower
that referenced
this pull request
Sep 20, 2015
sifo
added a commit
to sifo/bootstrap-bower
that referenced
this pull request
Sep 20, 2015
sifo
added a commit
to sifo/bootstrap-bower
that referenced
this pull request
Sep 20, 2015
sifo
added a commit
to sifo/bootstrap-bower
that referenced
this pull request
Sep 20, 2015
sifo
added a commit
to sifo/bootstrap-bower
that referenced
this pull request
Sep 20, 2015
sifo
added a commit
to sifo/bootstrap-bower
that referenced
this pull request
Sep 20, 2015
|
I am not able to reproduce it so I am not sure if this is stale or not. Please open an issue with a plunker if you think this is still an issue. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
andrepitombeira commentedDec 29, 2014
This is a fix for issue #2631.This calculates the scrollbar width and add it to body and fixed navbar.