mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(tap): Prevent multiple clicks when overriding cordova object, closes #1022
This commit is contained in:
@@ -35,6 +35,9 @@
|
||||
background: #FFFFCC;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var cordova = {};
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body ng-controller="MyCtrl">
|
||||
|
||||
@@ -213,24 +213,24 @@
|
||||
var TOUCH_TOLERANCE_Y = 2; // how much the Y coordinates can be off between start/end, but still a click
|
||||
|
||||
ionic.Platform.ready(function(){
|
||||
|
||||
if(ionic.Platform.grade === 'c') {
|
||||
// low performing phones should have a longer ghostclick prevent
|
||||
REMOVE_PREVENT_DELAY = 800;
|
||||
}
|
||||
|
||||
// set global click handler and check if the event should stop or not
|
||||
document.addEventListener('click', preventGhostClick, true);
|
||||
|
||||
// global release event listener polyfill for HTML elements that were tapped or held
|
||||
ionic.on("release", tapPolyfill, document);
|
||||
|
||||
// listeners used to remove ghostclick prevention
|
||||
document.addEventListener('touchend', removeClickPrevent, false);
|
||||
document.addEventListener('mouseup', removeClickPrevent, false);
|
||||
|
||||
// in the case the user touched the screen, then scrolled, it shouldn't fire the click
|
||||
document.addEventListener('touchstart', recordStartCoordinates, false);
|
||||
});
|
||||
|
||||
// set global click handler and check if the event should stop or not
|
||||
document.addEventListener('click', preventGhostClick, true);
|
||||
|
||||
// global release event listener polyfill for HTML elements that were tapped or held
|
||||
ionic.on("release", tapPolyfill, document);
|
||||
|
||||
// listeners used to remove ghostclick prevention
|
||||
document.addEventListener('touchend', removeClickPrevent, false);
|
||||
document.addEventListener('mouseup', removeClickPrevent, false);
|
||||
|
||||
// in the case the user touched the screen, then scrolled, it shouldn't fire the click
|
||||
document.addEventListener('touchstart', recordStartCoordinates, false);
|
||||
|
||||
|
||||
})(this, document, ionic);
|
||||
|
||||
Reference in New Issue
Block a user