mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
toggle tap
This commit is contained in:
@ -2,9 +2,9 @@
|
||||
|
||||
// add tap events to links
|
||||
function onLinkTap(e) {
|
||||
window.location = this.href;
|
||||
return false;
|
||||
this.click();
|
||||
}
|
||||
|
||||
function addTapToLinks() {
|
||||
for(var x = 0; x < document.links.length; x++) {
|
||||
if(!document.links[x]._hasTap) {
|
||||
@ -13,7 +13,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ionic.ResetTap = function() {
|
||||
addTapToLinks()
|
||||
};
|
||||
|
||||
28
ext/simple/toggle.js
Normal file
28
ext/simple/toggle.js
Normal 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);
|
||||
Reference in New Issue
Block a user