From d4ff49ae533caecbe63c0fb4a58b13deae6a1e44 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 9 Feb 2021 16:57:51 +0800 Subject: [PATCH] use scrollheight , and resize --- ux/Lightbox.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ux/Lightbox.js b/ux/Lightbox.js index a1b755120f..456aeb5138 100644 --- a/ux/Lightbox.js +++ b/ux/Lightbox.js @@ -357,8 +357,12 @@ Roo.apply(Roo.ux.Lightbox.prototype, // stretch overlay to fill page and fade in //var arrayPageSize = this.getPageSize(); - this.overlay.setHeight(Roo.lib.Dom.getDocumentHeight()) ; - this.overlay.setWidth(Roo.lib.Dom.getDocumentWidth()); + this.onResize(); + if (!this.resizer) { + this.resizer = Roo.EventManager.onWindowResize(this.onResize, this, true);; + } + + this.overlay.fadeIn({ endOpacity: this.overlayOpacity, easing: 'easeOut', @@ -378,7 +382,7 @@ Roo.apply(Roo.ux.Lightbox.prototype, } }); } - + // let's assume the constructor sorts out the list of images.. /* if ((imageLink.rel == 'lightbox')){ @@ -399,7 +403,7 @@ Roo.apply(Roo.ux.Lightbox.prototype, // weird.. why / 10? //var lightboxTop = s.top + (Roo.lib.Dom.getViewHeight() / 10); - var lightboxTop = (Roo.lib.Dom.getViewHeight() / 10); + var lightboxTop = (Roo.lib.Dom.getViewHeight() / 10) + document.body.scrollTop; var lightboxLeft = s.left; this.lightbox.setStyle({ top: lightboxTop + 'px', @@ -413,6 +417,11 @@ Roo.apply(Roo.ux.Lightbox.prototype, this.changeImage(imageNum); }, + onResize : function() + { + this.overlay.setHeight(Roo.lib.Dom.getDocumentHeight()) ; + this.overlay.setWidth(Roo.lib.Dom.getDocumentWidth()); + }, // // changeImage() // Hide most elements and preload image in preparation for resizing image container. -- 2.39.2