Dateien nach "assets/js" hochladen

This commit is contained in:
2025-12-10 09:32:40 +00:00
parent abe3680ab8
commit 190a879e0c
7 changed files with 281 additions and 0 deletions

42
assets/js/santa-sleigh.js Normal file
View File

@@ -0,0 +1,42 @@
(function($) {
// Nur ausführen, wenn die Body-Klasse vorhanden ist
if (!$('body').hasClass('festive-christmas')) {
return;
}
const pluginUrl = fsp_vars.plugin_url;
function createSanta() {
const $santa = $('<img>').attr('src', pluginUrl + 'assets/img/santa-claus.png').css({
position: 'fixed',
width: '380px', // Größer gemacht
bottom: '-350px', // Startet weiter außerhalb des Bildschirms
right: '-350px', // Startet weiter außerhalb des Bildschirms
zIndex: 9999,
pointerEvents: 'none',
transform: 'rotate(-15deg)' // Leichte Drehung für den Flugeffekt
});
$('body').append($santa);
// Animation von rechts nach links über den gesamten Bildschirm
$santa.animate({
bottom: window.innerHeight * 0.6, // Fliegt in der oberen Bildschirmhälfte
right: window.innerWidth + 350, // Fliegt komplett aus dem Bild links raus
opacity: 0.4 // Wird am Ende fast durchsichtig
}, {
duration: 18000, // 18 Sekunden Flugdauer für die große Strecke
easing: 'linear', // Gleichmäßige Geschwindigkeit
complete: function() {
$(this).remove(); // Entfernt das Bild nach der Animation
}
});
}
// Ersten Santa nach 5 Sekunden starten
setTimeout(createSanta, 8000);
// Alle 25 Sekunden einen neuen Santa starten
setInterval(createSanta, 25000);
})(jQuery);