Aller au contenu

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

De Wikiquestia
Aucun résumé des modifications
Aucun résumé des modifications
 
(2 versions intermédiaires par le même utilisateur non affichées)
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
alert('JavaScript is working!');
      document.querySelectorAll('.toggle-column').forEach(function (title) {
        title.style.fontWeight = 'normal';
      });
      this.style.fontWeight = 'bold';
    });
  });
});

Dernière version du 2 avril 2025 à 11:59

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

alert('JavaScript is working!');