Browse Source

Revert "Fixed "active" class bug with toggle"

This reverts commit 790d5300b0.
pull/839/head
thewax 9 years ago
parent
commit
5ca4ef5259
  1. 19
      js/segmented-controllers.js

19
js/segmented-controllers.js

@ -21,20 +21,20 @@
} }
} }
}; };
var tabTouchEnd = function (e) {
window.addEventListener('touchend', function (e) {
var activeTab; var activeTab;
var activeBodies; var activeBodies;
var targetBody; var targetBody;
var targetTab = getTarget(e.target); var targetTab = getTarget(e.target);
var className = 'active'; var className = 'active';
var classSelector = '.control-content.active'; var classSelector = '.' + className;
var tabClassSelector = '.control-item.active';
if (!targetTab) { if (!targetTab) {
return; return;
} }
activeTab = targetTab.parentNode.querySelector(tabClassSelector); activeTab = targetTab.parentNode.querySelector(classSelector);
if (activeTab) { if (activeTab) {
activeTab.classList.remove(className); activeTab.classList.remove(className);
@ -59,9 +59,12 @@
} }
targetBody.classList.add(className); targetBody.classList.add(className);
}; });
window.addEventListener('touchend', tabTouchEnd);
window.addEventListener("MSPointerUp", tabTouchEnd); window.addEventListener('click', function (e) {
if (getTarget(e.target)) {
e.preventDefault();
}
});
window.addEventListener('click', function (e) { if (getTarget(e.target)) { preventDef(e); } });
}()); }());

Loading…
Cancel
Save