Question

I have a webapp created with JQuery Mobile v1.3.2 implementing IScrollView. When I'm scrolling the map vertically the Scroll View scrolls also. Is there a way to disable that behaviour, to cancel iscroll scrolling when scrolling the gmap?

Thanks in advance.

Était-ce utile?

La solution

The problem is that the map still seems to propagate touch events to iscroll. Let's try to prevent this by stopPropagation();

Edit
Here is the working jQuery mobile fiddle

var map_canvas = $('#map_canvas')[0];
// "mousedown" should be "touchstart" on mobile device
$(map_canvas).bind('mousedown', function(e) {
    e.stopPropagation();
});


A fiddle with plain javascript here.

var map_canvas = document.getElementById('map_canvas');
// "mousedown" should be "touchstart" on mobile device
map_canvas.addEventListener('mousedown', function(e) {
    e.stopPropagation();
}, false);


P.S.
Find here The link to the stopPropagation docs, comes in very handy some times ;)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top