« MediaWiki:Commons.js » : différence entre les versions
Apparence
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 18 : | Ligne 18 : | ||
}); | }); | ||
}); | }); | ||
}); | |||
document.addEventListener('DOMContentLoaded', function () { | |||
console.log('JavaScript is loaded and running!'); | |||
}); | }); | ||
Version du 2 avril 2025 à 11:39
document.addEventListener('DOMContentLoaded', function () {
// Add click event listeners to all elements with the class "toggle-column"
document.querySelectorAll('.toggle-column').forEach(function (element) {
element.addEventListener('click', function () {
const target = this.getAttribute('data-target'); // Get the target column ID
// Hide all columns
document.querySelectorAll('.infobox-column').forEach(function (column) {
column.style.display = 'none';
});
// Show the selected column
document.getElementById(target).style.display = 'block';
// Update the styling of the active title
document.querySelectorAll('.toggle-column').forEach(function (title) {
title.style.fontWeight = 'normal';
});
this.style.fontWeight = 'bold';
});
});
});
document.addEventListener('DOMContentLoaded', function () {
console.log('JavaScript is loaded and running!');
});