mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-28 01:50:09 +00:00
Merge "Make the behavior of the lightbox more consistent with scroll"
This commit is contained in:
commit
666f2b3af3
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue