Skip to content
This repository was archived by the owner on May 29, 2019. 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
Closed

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

wants to merge 1 commit into from

Conversation

andrepitombeira
Copy link

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

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'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use

var fixedElements = angular.element(body.querySelector('.navbar-fixed-top, .navbar-fixed-bottom, .affix'));

@wesleycho
Copy link
Contributor

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(); }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

whats the status on this pr?

This is a fix for issue #2631.This calculates the scrollbar width and add it to body and fixed navbar.
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
Contributor

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
Development

Successfully merging this pull request may close these issues.

6 participants