User:TheMcr/common.js: Difference between revisions

Boobpedia - Encyclopedia of big boobs
Jump to navigationJump to search
(Created page with "document.addEventListener('DOMContentLoaded', function () { var images = document.querySelectorAll('img'); // Select all images on the page images.forEach(function (image) { // On mouse enter (hover) image.addEventListener('mouseenter', function () { image.style.transition = 'transform 0.3s ease'; // Smooth transition for scaling image.style.transform = 'scale(1.25)'; // Increase image size by 10% }); //...")
 
No edit summary
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener("DOMContentLoaded", function () {
     var images = document.querySelectorAll('img'); // Select all images on the page
     const table = document.querySelector('.wikitable');


     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'; // Smooth transition for scaling
    setTimeout(function() {
             image.style.transform = 'scale(1.25)'; // Increase image size by 10%
         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";
         });
         });


         // On mouse leave (hover out)
         row.addEventListener('mouseleave', function() {
        image.addEventListener('mouseleave', function () {
             row.style.transform = "scale(1)";
             image.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
        });
    });
});