mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-12-05 11:08:17 +00:00
038103299a
Not used in MobileFrontend so it is moved here from that repo. t r Change-Id: I97e6010026daf4c6610bcfbedf140fb2a45b1130
22 lines
559 B
JavaScript
22 lines
559 B
JavaScript
( function ( M, $ ) {
|
|
var BackToTopOverlay = M.require( 'skins.minerva.backtotop/BackToTopOverlay' ),
|
|
backtotop = new BackToTopOverlay(),
|
|
browser = M.require( 'mobile.startup/Browser' ).getSingleton();
|
|
|
|
// check if browser user agent is iOS (T141598)
|
|
if ( browser.isIos() ) {
|
|
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, jQuery ) );
|