toggle tap

This commit is contained in:
Adam Bradley
2013-09-24 15:23:03 -05:00
parent abf2f76c1f
commit e81be11d35
5 changed files with 43 additions and 9 deletions

28
ext/simple/toggle.js Normal file
View File

@ -0,0 +1,28 @@
(function(window) {
iconic = window.iconic || {};
// add tap events to links
function onToggleTap(e) {
if(e.currentTarget.control) {
e.currentTarget.control.checked = !e.currentTarget.control.checked;
e.stopPropagation();
}
}
ionic.ResetToggles = function() {
var
x,
toggles = document.getElementsByClassName("toggle");
for(x = 0; x < toggles.length; x++) {
if(!toggles[x].hasTap) {
ionic.on('tap', onToggleTap, toggles[x]);
toggles[x].hasTap = true;
}
}
};
ionic.ResetToggles();
})(this);