Page 2 of 2

Ios and Android prevent double/multiple tap on element

Posted: Sat Mar 15, 2014 12:22 pm
by Tom6106181

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


Ios and Android prevent double/multiple tap on element

Posted: Fri May 16, 2014 2:57 pm
by Alex GG

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


Ios and Android prevent double/multiple tap on element

Posted: Fri May 16, 2014 7:12 pm
by Evgene Karachevtsev

Hello Alex,

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


Ios and Android prevent double/multiple tap on element

Posted: Fri May 16, 2014 7:34 pm
by Alex GG

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


Ios and Android prevent double/multiple tap on element

Posted: Fri May 16, 2014 8:01 pm
by Alex GG

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

Regards