Skip to content
This repository has been archived by the owner. It is now read-only.

fix(modal): Fix background move a little when opening a modal #3144

Closed
wants to merge 1 commit into from

Conversation

@andrepitombeira
Copy link

andrepitombeira commented Dec 29, 2014

This is a fix for issue #2631.This calculates the scrollbar width and add it to body and fixed navbar.

@wesleycho wesleycho force-pushed the angular-ui:master branch from e373941 to 2c2dba6 Mar 23, 2015
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.

Copy link
@wesleycho

wesleycho Mar 31, 2015

Member

Use

var fixedElements = angular.element(body.querySelector('.navbar-fixed-top, .navbar-fixed-bottom, .affix'));
@@ -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.

Copy link
@wesleycho

wesleycho Mar 31, 2015

Member

Use

var body = $document[0].body;
if (backdropScope) {
backdropScope.index = newBackdropIndex;
}
});

function removeModalWindow(modalInstance) {
function checkScrollBar() {
if ($document[0].body.clientWidth >= window.innerWidth ) { return; }

This comment has been minimized.

Copy link
@wesleycho

wesleycho Mar 31, 2015

Member

Use body instead of $document[0].body

}

function measureScrollBar() {
scrollBarWidth = window.innerWidth - $document[0].body.clientWidth;

This comment has been minimized.

Copy link
@wesleycho
@wesleycho
Copy link
Member

wesleycho commented Mar 31, 2015

Can you create a Plunker illustrating this in action?

@@ -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.

Copy link
@arma-gast

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
Copy link

TilmannBach commented Sep 1, 2015

whats the status on this pr?

@andrepitombeira andrepitombeira force-pushed the andrepitombeira:master branch 2 times, most recently from 054ed91 to 3e699b2 Sep 6, 2015
This is a fix for issue #2631.This calculates the scrollbar width and add it to body and fixed navbar.
@andrepitombeira andrepitombeira force-pushed the andrepitombeira:master branch from 3e699b2 to 9697392 Sep 6, 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
sifo added a commit to sifo/bootstrap-bower that referenced this pull request Sep 20, 2015
@Foxandxss
Copy link
Member

Foxandxss commented Oct 15, 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.

@Foxandxss Foxandxss closed this Oct 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.