MediaWiki:Common.js: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 19: | Zeile 19: | ||
$('body').prepend($watermark); | $('body').prepend($watermark); | ||
}); | |||
$(() => { | |||
const enabled = $('#enableHeroImage').length; | |||
const action = new URLSearchParams(window.location.search).get('action') | |||
if (!(enabled && (!action || action == 'view' ))) { | |||
return; | |||
} | |||
const $container = $('#heroImg').html(''); | |||
const $img = $('<img></img>') | |||
.attr('src', '/i/c/c1/HeroImageHauptseite.png'); | |||
$container.append($img); | |||
$(window).on('scroll', function() { | |||
var scrollTop = $(this).scrollTop(); // how far the user has scrolled | |||
var fadeStart = 0; // start fading at scrollY=0 | |||
var fadeEnd = 300; // fully invisible at scrollY=300 | |||
var opacity = 1 - (scrollTop - fadeStart) / (fadeEnd - fadeStart); | |||
opacity = Math.max(0, Math.min(1, opacity)); | |||
$('#heroImg img').css('opacity', opacity); | |||
}); | |||
}); | }); | ||
Version vom 16. Dezember 2025, 16:09 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */
$(() => {
$('img#watermark').remove();
const $watermark = $('<img></img>')
.attr('src', '/archium/Logo.svg')
.attr('id', 'watermark')
.attr('style', `
position: fixed;
top: 120px;
left: 50px;
width: 250px;
height: 250px;
opacity: .7;
filter: grayscale(1) contrast(2) drop-shadow(3px 3px 5px black);
mix-blend-mode: multiply;
`);
$('body').prepend($watermark);
});
$(() => {
const enabled = $('#enableHeroImage').length;
const action = new URLSearchParams(window.location.search).get('action')
if (!(enabled && (!action || action == 'view' ))) {
return;
}
const $container = $('#heroImg').html('');
const $img = $('<img></img>')
.attr('src', '/i/c/c1/HeroImageHauptseite.png');
$container.append($img);
$(window).on('scroll', function() {
var scrollTop = $(this).scrollTop(); // how far the user has scrolled
var fadeStart = 0; // start fading at scrollY=0
var fadeEnd = 300; // fully invisible at scrollY=300
var opacity = 1 - (scrollTop - fadeStart) / (fadeEnd - fadeStart);
opacity = Math.max(0, Math.min(1, opacity));
$('#heroImg img').css('opacity', opacity);
});
});