Skip to content

Commit

Permalink
Change zoom disabling logic to be iOS-specific
Browse files Browse the repository at this point in the history
  • Loading branch information
pganssle committed Nov 26, 2023
1 parent e98c9ce commit d4219ef
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,26 @@
<script type="module" src="js/vendor/Tone.js"></script>
<script src="js/cim.js"></script>
<script>
function is_ios() {
return [
'iPad Simulator',
'iPhone Simulator',
'iPod Simulator',
'iPad',
'iPhone',
'iPod'
].includes(navigator.platform)
// iPad on iOS 13 detection
|| (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}

// Disable zoom on iOS 10+ (normally I would be against this, but it's
// causing usability problems)
document.addEventListener('gesturestart', function (e) {
e.preventDefault();
});
if (is_ios()) {
document.addEventListener('gesturestart', function (e) {
e.preventDefault();
});
}
</script>

</head>
Expand Down

0 comments on commit d4219ef

Please sign in to comment.