User:Editingthingsforlife/vector-2022.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
// Eerie JavaScript effects for Descent Wiki | // Eerie JavaScript effects for Descent Wiki | ||
$(document).ready(function() { | $(document).ready(function() { | ||
// 1. | // 1. Background Flicker | ||
const backgroundContainer = $('#mw-content-text'); | const backgroundContainer = $('#mw-content-text'); | ||
if (backgroundContainer.length) { | if (backgroundContainer.length) { | ||
setInterval(function() { | setInterval(function() { | ||
backgroundContainer.css('opacity', Math.random() * 0.1 + 0.9); // | backgroundContainer.css('opacity', Math.random() * 0.1 + 0.9); // Flicker between 0.9 and 1 opacity | ||
}, | }, 4000 + Math.random() * 3000); // Flicker every 4-7 seconds | ||
} | } | ||
// 2. Hover | // 2. Glitchy Hover on Sidebar Links | ||
const sidebarLinks = $('.vector-menu-portal .vector-menu-content li a'); | const sidebarLinks = $('.vector-menu-portal .vector-menu-content li a'); | ||
sidebarLinks.each(function() { | sidebarLinks.each(function() { | ||
$(this).on('mouseover', function() { | $(this).on('mouseover', function() { | ||
$(this).css({ | $(this).css({ | ||
'transform': 'translateX(' + (Math.random() * | 'transform': 'translateX(' + (Math.random() * 5 - 2.5) + 'px)', // Random horizontal glitch | ||
'filter': 'brightness(0. | 'filter': 'brightness(0.7)' // Dim on hover | ||
}); | }); | ||
}).on('mouseout', function() { | }).on('mouseout', function() { | ||
Line 27: | Line 26: | ||
}); | }); | ||
// 3. Delayed | // 3. Delayed Fade-In for Welcome Message | ||
const | const welcomeMessage = $('.mw-parser-output p'); | ||
welcomeMessage.css('opacity', 0); // Start hidden | |||
setTimeout(function() { | setTimeout(function() { | ||
welcomeMessage.animate({ opacity: 1 }, 2500); // Fade in over 2.5 seconds | |||
}, | }, 1500); // Delay by 1.5 seconds | ||
}); | }); |
Revision as of 13:23, 14 May 2025
// Eerie JavaScript effects for Descent Wiki
$(document).ready(function() {
// 1. Background Flicker
const backgroundContainer = $('#mw-content-text');
if (backgroundContainer.length) {
setInterval(function() {
backgroundContainer.css('opacity', Math.random() * 0.1 + 0.9); // Flicker between 0.9 and 1 opacity
}, 4000 + Math.random() * 3000); // Flicker every 4-7 seconds
}
// 2. Glitchy Hover on Sidebar Links
const sidebarLinks = $('.vector-menu-portal .vector-menu-content li a');
sidebarLinks.each(function() {
$(this).on('mouseover', function() {
$(this).css({
'transform': 'translateX(' + (Math.random() * 5 - 2.5) + 'px)', // Random horizontal glitch
'filter': 'brightness(0.7)' // Dim on hover
});
}).on('mouseout', function() {
$(this).css({
'transform': 'translateX(0)',
'filter': 'brightness(1)'
});
});
});
// 3. Delayed Fade-In for Welcome Message
const welcomeMessage = $('.mw-parser-output p');
welcomeMessage.css('opacity', 0); // Start hidden
setTimeout(function() {
welcomeMessage.animate({ opacity: 1 }, 2500); // Fade in over 2.5 seconds
}, 1500); // Delay by 1.5 seconds
});