jenkins-bot has submitted this change and it was merged.
Change subject: Make the behavior of the lightbox more consistent with scroll
......................................................................
Make the behavior of the lightbox more consistent with scroll
Makes sure that the advanced description is out of view when
the lightbox opens.
Remembers the scrollTop position that was set when the lightbox
opens, in order to restore it when it closes.
Change-Id: I534f7d718528d1e5a4911c68a524eb96cadeae90
---
M resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
1 file changed, 22 insertions(+), 0 deletions(-)
Approvals:
MarkTraceur: Looks good to me, approved
jenkins-bot: Verified
diff --git
a/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
b/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
index c882d2e..8bd4a51 100644
--- a/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
+++ b/resources/ext.multimediaViewer/ext.multimediaViewer.lightboxinterface.js
@@ -89,6 +89,28 @@
}
};
+ LIP.attach = function ( parentId ) {
+ // Advanced description needs to be below the fold when the
lightbox opens
+ // regardless of what the scroll value was prior to opening the
lightbox
+ var $document = $( document );
+
+ // Save the scrollTop value because we want below to be back to
where they were
+ // before opening the lightbox
+ this.scrollTopBeforeAttach = $document.scrollTop();
+ $document.scrollTop( 0 );
+
+ MLBInterface.prototype.attach.call( this, parentId );
+ };
+
+ LIP.unattach = function () {
+ MLBInterface.prototype.unattach.call( this );
+
+ // Restore the scrollTop as it was before opening the lightbox
+ if ( this.scrollTopBeforeAttach !== undefined ) {
+ $( document ).scrollTop( this.scrollTopBeforeAttach );
+ }
+ };
+
LIP.load = function ( image ) {
var hashFragment = '#mediaviewer/' +
mw.mediaViewer.currentImageFilename + '/' +
mw.mediaViewer.lightbox.currentIndex;
--
To view, visit https://gerrit.wikimedia.org/r/106263
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I534f7d718528d1e5a4911c68a524eb96cadeae90
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Gilles <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits