mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(popup): if popup is taller than the window, shrink the popup body and make it scrollable. Closes #1679
This commit is contained in:
11
js/angular/service/popup.js
vendored
11
js/angular/service/popup.js
vendored
@@ -317,6 +317,17 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $docume
|
||||
//if hidden while waiting for raf, don't show
|
||||
if (!self.isShown) return;
|
||||
|
||||
//if the popup is taller than the window, make the popup body scrollable
|
||||
if(self.element[0].offsetHeight > window.innerHeight - 20){
|
||||
self.element[0].style.height = window.innerHeight - 20+'px';
|
||||
popupBody = self.element[0].querySelectorAll('.popup-body');
|
||||
popupHead = self.element[0].querySelectorAll('.popup-head');
|
||||
popupButtons = self.element[0].querySelectorAll('.popup-buttons');
|
||||
self.element.addClass('popup-tall');
|
||||
newHeight = window.innerHeight - popupHead[0].offsetHeight - popupButtons[0].offsetHeight -20;
|
||||
popupBody[0].style.height = newHeight + 'px';
|
||||
};
|
||||
|
||||
self.element.removeClass('popup-hidden');
|
||||
self.element.addClass('popup-showing active');
|
||||
ionic.DomUtil.centerElementByMarginTwice(self.element[0]);
|
||||
|
||||
Reference in New Issue
Block a user