From b9eecfed28c351570cc1d797febe00e8fb7277db Mon Sep 17 00:00:00 2001 From: Gilles Dubuc Date: Fri, 31 Jan 2014 11:35:50 +0100 Subject: [PATCH] Place the metadata correctly before opening the lightbox The issue was happening because the metadata div was placed without waiting for dom load. Also, the code ignored the fact that the window size might change between page load and when the lightbox is open. Change-Id: Ib44720a7f989803b3f59aebcd33e94f610f51325 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/141 --- resources/mmv/mmv.lightboxinterface.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/mmv/mmv.lightboxinterface.js b/resources/mmv/mmv.lightboxinterface.js index be76df99f..95c926430 100644 --- a/resources/mmv/mmv.lightboxinterface.js +++ b/resources/mmv/mmv.lightboxinterface.js @@ -117,6 +117,11 @@ $.scrollTo( 0, 0 ); } + // Make sure that the metadata is going to be at the bottom when it appears + // 83 is the height of the top metadata area. Which can't be measured by + // reading the DOM at this point of the execution, unfortunately + this.$postDiv.css( 'top', ( $( window ).height() - 83 ) + 'px' ); + MLBInterface.prototype.attach.call( this, parentId ); }; @@ -147,8 +152,6 @@ }; LIP.initializeInterface = function () { - this.$postDiv.css( 'top', ( $( window ).height() - 83 ) + 'px' ); - this.initializeHeader(); this.initializeNavigation(); this.initializeButtons();