MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
Created page with "→Any JavaScript here will be loaded for all users on every page load.: document.addEventListener("DOMContentLoaded", function () { document.querySelectorAll(".hover-image").forEach(function (element) { let imgSrc = element.getAttribute("data-image"); if (imgSrc) { let preview = document.createElement("img"); preview.src = imgSrc; preview.style.position = "absolute"; preview.style.width = "200px"; //..." |
No edit summary |
||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
document.addEventListener("DOMContentLoaded", function () { | document.addEventListener("DOMContentLoaded", function () { | ||
document.querySelectorAll(".hover | document.querySelectorAll(".image-hover").forEach(function (link) { | ||
link.addEventListener("mouseover", function () { | |||
let img = link.querySelector("img"); | |||
let | if (img) { | ||
img.style.display = "block"; | |||
} | |||
}); | |||
link.addEventListener("mouseout", function () { | |||
let img = link.querySelector("img"); | |||
if (img) { | |||
img.style.display = "none"; | |||
} | |||
}); | |||
} | |||
} | |||
}); | }); | ||
}); | }); | ||
Revision as of 20:41, 12 February 2025
/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll(".image-hover").forEach(function (link) {
link.addEventListener("mouseover", function () {
let img = link.querySelector("img");
if (img) {
img.style.display = "block";
}
});
link.addEventListener("mouseout", function () {
let img = link.querySelector("img");
if (img) {
img.style.display = "none";
}
});
});
});