MediaWiki:Vector.js: Difference between revisions

From Forklift Certified Video Games
Jump to navigation Jump to search
Line 11: Line 11:
const isOpen = section.style.display === 'block';
const isOpen = section.style.display === 'block';
section.style.display = isOpen ? 'none' : 'block';
section.style.display = isOpen ? 'none' : 'block';
});
document.addEventListener("DOMContentLoaded", function() {
  const slides = document.querySelectorAll(".news-slider .news-slide");
  let current = 0;
 
  function showSlide(index) {
    slides.forEach((s, i) => {
      s.style.opacity = (i === index) ? "1" : "0";
    });
  }
  setInterval(() => {
    current = (current + 1) % slides.length;
    showSlide(current);
  }, 4000); // 4 seconds per slide
});
});

Revision as of 22:13, 24 January 2026

/* All JavaScript here will be loaded for users of the Vector skin */

document.addEventListener('click', function (e) {
	const header = e.target.closest('.pf-collapsible');
	if (!header) return;

	const targetId = header.dataset.target;
	const section = document.getElementById(targetId);
	if (!section) return;

	const isOpen = section.style.display === 'block';
	section.style.display = isOpen ? 'none' : 'block';
});

document.addEventListener("DOMContentLoaded", function() {
  const slides = document.querySelectorAll(".news-slider .news-slide");
  let current = 0;
  
  function showSlide(index) {
    slides.forEach((s, i) => {
      s.style.opacity = (i === index) ? "1" : "0";
    });
  }

  setInterval(() => {
    current = (current + 1) % slides.length;
    showSlide(current);
  }, 4000); // 4 seconds per slide
});