User:TheMcr/common.js: Difference between revisions

Boobpedia - Encyclopedia of big boobs
Jump to navigationJump to search
No edit summary
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener("DOMContentLoaded", function () {
     // Handle images
     const table = document.querySelector('.wikitable');
    var images = document.querySelectorAll('img'); // Select all images on the page


     images.forEach(function (image) {
     // Apply fade-in effect
        // On mouse enter (hover)
    table.style.opacity = 0;
        image.addEventListener('mouseenter', function () {
    table.style.transition = "opacity 2s";
            image.style.transition = 'transform 0.3s ease, box-shadow 0.3s ease'; // Smooth transition for scaling and shadow
    setTimeout(function() {
            image.style.transform = 'scale(1.2)'; // Increase image size by 20%
        table.style.opacity = 1;
            image.style.boxShadow = '0px 4px 10px rgba(0, 0, 0, 0.3)'; // Add a subtle shadow
     }, 10);
        });
 
        // On mouse leave (hover out)
        image.addEventListener('mouseleave', function () {
            image.style.transform = 'scale(1)'; // Reset to original size
            image.style.boxShadow = 'none'; // Remove the shadow
        });
     });
 
    // Handle links
    var links = document.querySelectorAll('a'); // Select all links on the page


     links.forEach(function (link) {
     // Hover effect for each row
        // On mouse enter (hover)
    const rows = table.querySelectorAll('tr');
         link.addEventListener('mouseenter', function () {
    rows.forEach(row => {
             link.style.transition = 'transform 0.3s ease'; // Smooth transition for scaling
         row.addEventListener('mouseenter', function() {
             link.style.transform = 'scale(1.2)'; // Increase link size by 20%
             row.style.transform = "scale(1.05)";
            row.style.transition = "transform 0.3s ease, background-color 0.3s ease";
             row.style.backgroundColor = "#f0f0f0";
         });
         });


         // On mouse leave (hover out)
         row.addEventListener('mouseleave', function() {
        link.addEventListener('mouseleave', function () {
             row.style.transform = "scale(1)";
             link.style.transform = 'scale(1)'; // Reset to original size
            row.style.backgroundColor = ""; // reset background color
         });
         });
     });
     });
});
});

Latest revision as of 15:59, 5 April 2025

document.addEventListener("DOMContentLoaded", function () {
    const table = document.querySelector('.wikitable');

    // Apply fade-in effect
    table.style.opacity = 0;
    table.style.transition = "opacity 2s";
    setTimeout(function() {
        table.style.opacity = 1;
    }, 10);

    // Hover effect for each row
    const rows = table.querySelectorAll('tr');
    rows.forEach(row => {
        row.addEventListener('mouseenter', function() {
            row.style.transform = "scale(1.05)";
            row.style.transition = "transform 0.3s ease, background-color 0.3s ease";
            row.style.backgroundColor = "#f0f0f0";
        });

        row.addEventListener('mouseleave', function() {
            row.style.transform = "scale(1)";
            row.style.backgroundColor = ""; // reset background color
        });
    });
});