Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ mw.loader.using('jquery', function () { $(function () { const carousel = document.querySelector('.card-carousel'); if (!carousel) return; let isDragging = false; let startX; let scrollStart; let movedEnough = false; carousel.addEventListener("pointerdown", function (e) { isDragging = true; movedEnough = false; carousel.classList.add("dragging"); startX = e.pageX; scrollStart = carousel.scrollLeft; carousel.setPointerCapture(e.pointerId); e.preventDefault(); }); carousel.addEventListener("pointermove", function (e) { if (!isDragging) return; const x = e.pageX; const walk = (x - startX) * 1; if (Math.abs(walk) > 5) movedEnough = true; carousel.scrollLeft = scrollStart - walk; e.preventDefault(); }); carousel.addEventListener("pointerup", function () { isDragging = false; carousel.classList.remove("dragging"); }); carousel.addEventListener("pointerleave", function () { isDragging = false; carousel.classList.remove("dragging"); }); // Block link clicks if a drag occurred carousel.addEventListener("click", function (e) { if (movedEnough) { e.preventDefault(); e.stopImmediatePropagation(); } }, true); // capture phase }); });