I assume that I have an input area for the <div> container with text, sliders, and buttons in it, and you want to prevent accidental double clicks on this <div> . The following does not prevent the input area from scaling, and it does not involve double-tapping and scaling outside of my <div> . There are various options depending on the browser application.
I just tried it.
(1) For Safari on iOS and Chrome on Android, it is the preferred method. It works, with the exception of the Internet application on Samsung, where it disables double-clicking not on the full <div> , but at least on the elements that handle the taps. It returns return false , with the exception of the inputs text and range .
$('selector of <div> input area').on('touchend',disabledoubletap); function disabledoubletap(ev) { var preventok=$(ev.target).is('input[type=text],input[type=range]'); if(preventok==false) return false; }
(2) If desired, double-clicking on the <div> is prohibited for the embedded Internet application on Android (5.1, Samsung), but it is forbidden to scale the <div> :
$('selector of <div> input area').on('touchstart touchend',disabledoubletap);
(3) For Chrome on Android 5.1, disables double-clicking, does not block scaling, and does nothing about double-tapping in other browsers. Double-clicking <meta name="viewport" ...> annoying because <meta name="viewport" ...> seems like good practice.
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, user-scalable=yes">
Peter Aug 16 '17 at 13:58 on 2017-08-16 13:58
source share