I have solved problems with tap on markers in google maps v3

Skip to first unread message


Mar 12, 2011, 8:26:12 AM3/12/11
to jQTouch
All taps and click on markers were being ignored only when test
aplication in the device.
But in the PC these problems did not occur.

I found out that the problem disappeared if I set the jQTouch var
useFastTouch = false (by default it is true).
But that wasn't a good idea, fix a problem but it brings yield
problems in general use.
I found this lines in jQTouch code
This script annuls the blows in the canvas of the Gmap object.

if (jQTSettings.useFastTouch && $.support.touch)
var $el = $(e.target);

if ($el.attr('target') == '_blank' ||
$el.attr('rel') == 'external' || $el.is('input[type="checkbox"]'))
return true;
} else {
return false;

This script annuls clicks on canvas of the Gmap object.
But I add this to the IF clause:

if ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' ||
$el.is('input[type="checkbox"]') || $el.is('canvas'))

Now the problem is fixed and without having to discard useFastTouch

I hope this help somebody too.
And I leave it so that include next versions of Jqtouch if you want.

Thanks for the aid that I have received from other users of the group.
Thanks David Kaneda and Jonathan Stark for this great product.

Chris C

Mar 12, 2011, 11:50:19 AM3/12/11
to jQTouch
RRS thank you for this post and your fix. You will note a few posts
back I complained about a recent fix in GM 3.4 that kept click events
from occurring. This solution solves that.

But the embarrassing part is that I pointed out this very solution
(not quite as elegantly as you have described here) a number of months
ago. Since my solution was specific to my app it only worked on one
map. As I added others, and as Google changed their code, this problem
was exacerbated.

Your solution offers me a general fix to the problem and now perhaps I
will not embarrass myself again complaining about a problem and a
solution I already knew about :-)

Chris C

May 9, 2011, 2:14:58 PM5/9/11
to jQTouch
...> This script  annuls clicks oncanvasof the Gmap object.
> But I add this to the IF clause:
> if ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' ||
> $el.is('input[type="checkbox"]') || $el.is('canvas'))
> Now the problem is fixed and without having to discard  useFastTouch
> feature.
An update to this. It appears that not all clicks to the map are going
to the 'canvas'. I have registered a
google.maps.event.addListener(map, 'click', mapClick) event and most
of those taps make it through this but many do not. I am not sure what
they are being targeted to but its not the 'canvas'.

I verified that they were getting to this function so its a matter of
seeing what target object they are intended for and adding that to the

Chris C

May 9, 2011, 9:21:52 PM5/9/11
to jQTouch
After a lot of investigation it appears that the target is not always
the canvas. Sometimes its a peer of the canvas's. I have no idea why.
So to be complete I modified the fix above. Its not very good jQuery
and maybe someone can improve it.

var isMapPeer = false;
if($el.parent().has('canvas').length >0){
isMapPeer = true;

if ($el.attr('target') == '_blank' || $el.attr('rel') == 'external' ||
isMapPeer ||
$el.is('input[type="checkbox"]') || $el.is('input[type="radio"]'))
Reply all
Reply to author
0 new messages