mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-15 02:13:49 +00:00
def03877ce
Bug: T208951 Change-Id: I7cd5ab010596d964fc0896ed250f40d5b6344f6e
23 lines
624 B
JavaScript
23 lines
624 B
JavaScript
( function ( M ) {
|
|
var BackToTopOverlay = M.require( 'skins.minerva.options/BackToTopOverlay' ),
|
|
backtotop = new BackToTopOverlay(),
|
|
features = mw.config.get( 'wgMinervaFeatures', {} ),
|
|
browser = M.require( 'mobile.startup/Browser' ).getSingleton();
|
|
|
|
// check if browser user agent is iOS (T141598)
|
|
if ( browser.isIos() || !features.backToTop ) {
|
|
return;
|
|
}
|
|
|
|
// initialize the back to top element
|
|
backtotop.appendTo( 'body' );
|
|
|
|
M.on( 'scroll', function () {
|
|
if ( $( window ).height() - $( window ).scrollTop() <= 0 ) {
|
|
backtotop.show();
|
|
} else {
|
|
backtotop.hide();
|
|
}
|
|
} );
|
|
}( mw.mobileFrontend ) );
|