google maps click on blackberry mobile web
I'm having trouble getting the click event on a google map trigger in a blackberry web environment. The click bubbles up to the div wrapper and gets triggered, but never tri开发者_JAVA技巧ggers the internal maps event.
I've setup a test page at http://www.codenothing.com/dev/2011/blackberry-map-click/index.html with alerts attached to element click handle and map click handle. Here's the javascript on the page:
function MapsLoaded(){
var elem = document.getElementById( 'map' ),
map = new google.maps.Map( elem, {
mapTypeControl: false,
overviewMapControl: false,
scrollwheel: false,
streetViewControl: false,
panControl: true,
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
},
zoom: 16,
center: new google.maps.LatLng( 37.78778, -122.407637 ),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
elem.addEventListener( 'click', function(){
alert( 'Element Click' );
}, false);
google.maps.event.addListener( map, 'click', function(){
alert( 'Map Click' );
});
}
window.onload = function(){
var script = document.createElement('script');
script.type = "text/javascript";
script.src = "http://maps.google.com/maps/api/js?sensor=true&callback=MapsLoaded";
document.body.appendChild( script );
};
精彩评论