Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Ios and Android prevent double/multiple tap on element

For those of you out there, struggling with the same issue, here is a plugin;
code
(function($){
$.fn.nodoubletapzoom = function(){
$(this).bind('touchend', function preventZoom(e){
var now = new Date().getTime();
var lastTouch = $(this).data('lastTouch') || now + 1;
var delta = now - lastTouch;

Code: Select all

if(delta<500 && delta>0){ 
             e&#46;preventDefault(); 
             $(this)&#46;trigger('click')&#46;trigger('click'); 
} 
$(this)&#46;data('lastTouch', now); 

});
};
})(jQuery);
/code

and simply invoke this on anyelement you need to prevent zoom on;
code
$('#MyElementId')&#46;nodoubletapzoom();
/code

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

Ios and Android prevent double/multiple tap on element

Hi!
I have this problem on all my Dialogs Screen, I added the plugin, and invoke this js on page load, but cant fixed the problem yet..

I use:

$('#mobilegrid_33').nodoubletapzoom();

and

$('#mobilecontainer').nodoubletapzoom();

As I said, this problem is on all (6) Dialogs on my app, but this problem is not on any Screen (8)..

Any idea?

Regards

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Ios and Android prevent double/multiple tap on element

Hello Alex,

Please try running your JS code on "page show" event.

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

Ios and Android prevent double/multiple tap on element

Hi, Evgene,
I tried on page show, but is the same, double tapping on the "Dialog screen" zooms out everything...This only happens on iOs, android seems to work fine.

I shared my app, name is distritofitness, the steps to reproduce this is open panel with icon bars, and then on the last item, (info/acerca) open a Dialog.
Double tap on it an see how it zooms out.

Regards

Alex GG
Posts: 0
Joined: Thu Nov 14, 2013 11:11 pm

Ios and Android prevent double/multiple tap on element

Thanks, I just Removed the # from MyelementID, and now works fine.

Regards

Return to “Issues”