mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-09-29 13:17:35 +00:00
Fix Chrome bug where popstate could still reset scroll position
Change-Id: I3418b2e446a210a406daacc1321103df1f09caa1 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/486
This commit is contained in:
parent
7ac4b375b6
commit
292f42dc7c
|
@ -373,6 +373,8 @@
|
|||
* Cleans up the overlay
|
||||
*/
|
||||
MMVB.cleanupOverlay = function () {
|
||||
var bootstrap = this;
|
||||
|
||||
$( document.body ).removeClass( 'mw-mmv-lightbox-open' );
|
||||
|
||||
if ( this.$overlay ) {
|
||||
|
@ -380,8 +382,8 @@
|
|||
}
|
||||
|
||||
if ( this.savedScroll ) {
|
||||
$.scrollTo( this.savedScroll, 0 );
|
||||
this.savedScroll = undefined;
|
||||
// setTimeout because otherwise Chrome will scroll back to top after the popstate event handlers run
|
||||
setTimeout( function() { $.scrollTo( bootstrap.savedScroll, 0 ); bootstrap.savedScroll = undefined; }, 0 );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue