diff --git a/dist/ratchet.js b/dist/ratchet.js index 0e6d31b..ca608ee 100644 --- a/dist/ratchet.js +++ b/dist/ratchet.js @@ -527,7 +527,7 @@ window.addEventListener("touchend", function (e) { var activeTab; - var activeBody; + var activeBodies; var targetBody; var targetTab; var className = 'active'; @@ -549,11 +549,13 @@ if (!targetBody) return; - activeBody = targetBody.parentNode.querySelector(classSelector); + activeBodies = targetBody.parentNode.querySelectorAll(classSelector); - if (activeBody) activeBody.classList.remove(className); + for (var i = 0; i < activeBodies.length; i++) { + activeBodies[i].classList.remove(className); + } - targetBody.classList.add(className) + targetBody.classList.add(className); }); window.addEventListener('click', function (e) { if (getTarget(e.target)) e.preventDefault(); }); diff --git a/lib/js/segmented-controllers.js b/lib/js/segmented-controllers.js index 6c1111d..8e54923 100644 --- a/lib/js/segmented-controllers.js +++ b/lib/js/segmented-controllers.js @@ -14,7 +14,7 @@ window.addEventListener("touchend", function (e) { var activeTab; - var activeBody; + var activeBodies; var targetBody; var targetTab; var className = 'active'; @@ -36,11 +36,13 @@ if (!targetBody) return; - activeBody = targetBody.parentNode.querySelector(classSelector); + activeBodies = targetBody.parentNode.querySelectorAll(classSelector); - if (activeBody) activeBody.classList.remove(className); + for (var i = 0; i < activeBodies.length; i++) { + activeBodies[i].classList.remove(className); + } - targetBody.classList.add(className) + targetBody.classList.add(className); }); window.addEventListener('click', function (e) { if (getTarget(e.target)) e.preventDefault(); });