Aller au contenu

« MediaWiki:Commons.js » : différence entre les versions

De Wikiquestia
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('DOMContentLoaded', function () {
  // Add click event listeners to all elements with the class "toggle-column"
     console.log('Custom JavaScript is loaded!');
  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!');
});
});

Version du 2 avril 2025 à 11:59

document.addEventListener('DOMContentLoaded', function () {
    console.log('Custom JavaScript is loaded!');
});