MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus Geoportal
Karlo (Diskussion | Beiträge) |
Karlo (Diskussion | Beiträge) |
||
Zeile 23: | Zeile 23: | ||
function addBackToTopButton () { |
function addBackToTopButton () { |
||
− | $('<div id="backtotop" style="position: fixed;right: 20px;bottom: 20px;border: 2px solid red;padding: 30px;border-radius: 50%;cursor: pointer;background-color: red;color: white;background-image: url("../../mapbender/img/geoportal2019/up.svg");background-repeat: no-repeat;background-position: center center;background-size: 2em auto;box-shadow: rgba(0, 0, 0, 0.3) 2px 2px 10px;"><span type="button" value="^" onClick="goToTop();"> |
+ | $('<div id="backtotop" style="position: fixed;right: 20px;bottom: 20px;border: 2px solid red;padding: 30px;border-radius: 50%;cursor: pointer;background-color: red;color: white;background-image: url("../../mapbender/img/geoportal2019/up.svg");background-repeat: no-repeat;background-position: center center;background-size: 2em auto;box-shadow: rgba(0, 0, 0, 0.3) 2px 2px 10px;"><span type="button" value="^" onClick="goToTop();"> </span></div>').appendTo('#mw-content'); |
fadedHide (); |
fadedHide (); |
||
} |
} |
Version vom 5. Juni 2020, 11:45 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */ function fadedHide () { // hide #backtotop $( "#backtotop" ).hide (); // fade in #backtotop $( function () { $( window ).scroll( function () { if ( $( this ).scrollTop () > ButtonStart ) { $( '#backtotop' ).fadeIn (); } else { $( '#backtotop' ).fadeOut (); } }); }); } function goToTop (){ $( 'body,html' ).animate ({ scrollTop: 0 }, ScrollSpeed ); return false; } function addBackToTopButton () { $('<div id="backtotop" style="position: fixed;right: 20px;bottom: 20px;border: 2px solid red;padding: 30px;border-radius: 50%;cursor: pointer;background-color: red;color: white;background-image: url("../../mapbender/img/geoportal2019/up.svg");background-repeat: no-repeat;background-position: center center;background-size: 2em auto;box-shadow: rgba(0, 0, 0, 0.3) 2px 2px 10px;"><span type="button" value="^" onClick="goToTop();"> </span></div>').appendTo('#mw-content'); fadedHide (); } var ButtonStart = 800; var ScrollSpeed = 600; if( !window.BackToTop ) { $( document ).ready( function () { addBackToTopButton (); }); } var BackToTop = true; // prevent duplication