Jump to content

User:Editingthingsforlife/vector-2022.js: Difference between revisions

From Madness Descent (Roblox) Wiki
Editingthingsforlife (talk | contribs)
No edit summary
Editingthingsforlife (talk | contribs)
No edit summary
Line 1: Line 1:
// Eerie JavaScript effects for Descent Wiki
// Eerie JavaScript effects for Descent Wiki


// Wait for the DOM to load
$(document).ready(function() {
$(document).ready(function() {
     // 1. Subtle Background Flicker
     // 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); // Random opacity between 0.9 and 1
             backgroundContainer.css('opacity', Math.random() * 0.1 + 0.9); // Flicker between 0.9 and 1 opacity
         }, 3000 + Math.random() * 2000); // Flicker every 3-5 seconds
         }, 4000 + Math.random() * 3000); // Flicker every 4-7 seconds
     }
     }


     // 2. Hover Distortion on Sidebar Links
     // 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() * 4 - 2) + 'px)', // Slight horizontal glitch
                 'transform': 'translateX(' + (Math.random() * 5 - 2.5) + 'px)', // Random horizontal glitch
                 'filter': 'brightness(0.8)' // Dim on hover
                 'filter': 'brightness(0.7)' // Dim on hover
             });
             });
         }).on('mouseout', function() {
         }).on('mouseout', function() {
Line 27: Line 26:
     });
     });


     // 3. Delayed Text Fade-In for Main Content
     // 3. Delayed Fade-In for Welcome Message
     const mainContent = $('.mw-parser-output');
     const welcomeMessage = $('.mw-parser-output p');
     mainContent.css('opacity', 0); // Start hidden
     welcomeMessage.css('opacity', 0); // Start hidden
     setTimeout(function() {
     setTimeout(function() {
         mainContent.animate({ opacity: 1 }, 2000); // Fade in over 2 seconds
         welcomeMessage.animate({ opacity: 1 }, 2500); // Fade in over 2.5 seconds
     }, 1000); // Delay by 1 second
     }, 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
});
Cookies help us deliver our services. By using our services, you agree to our use of cookies.