View Full Version : google maps, marker popup

15 Mar 2011, 4:03 AM
Hi. Can anyone give me an example of how create marker popups?

I have this:

google.maps.event.addListener(marker, 'click', function() {
infowindow = new google.maps.InfoWindow({
content: "<h4>"+marker.title + "</h4><br /><br />" + marker.body
it works on Chrome for example, but doesn't work in Android, any help? Thanks

15 Mar 2011, 7:01 AM
This is what I am using... I'll check it on android and get back to you.

uin.map.addCampus = function() {
var map = Ext.getCmp('Map').map,
address = 'Morkvedtrakket 30, Bodo',
imageUrl = 'images/campus.png';

uin.map.geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {


var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: new google.maps.MarkerImage(imageUrl, new google.maps.Size(73,36), new google.maps.Point(0,0), new google.maps.Point(15,10)),
animation: google.maps.Animation.DROP,
shape: {coord: [0,0,0,36,73,36,73,0], type: 'poly'}

var contentString = '<div>' +
'<img src="images/campus_info.png" width="150">' +

var infoWindow = new google.maps.InfoWindow({
content: contentString

google.maps.event.addListener(marker, 'click', function(){

} else {
alert('Ingen resultat');

Looks pretty much the same.

17 Mar 2011, 3:06 PM
Thanks for the answer. I think the problem is the listener

google.maps.event.addListener(marker, 'click', function() {

I've tried this on a nexus one and on a iPhone and doesn't show the alert, but it's working in a samsung android...

17 Mar 2011, 11:48 PM
Try a 'mousedown' instead of a 'click', that works for me with chrome and an Ipad

18 Mar 2011, 12:31 AM
Try a 'mousedown' instead of a 'click', that works for me with chrome and an Ipad

Thanks! i've to try on iPhone but at least now it's working on the nexus one

28 Mar 2011, 11:46 AM
I am using the mouseup event and all is fine, but if I hit a marker while trying to drag the map I would like to ignore that mouseup. Any ideas how to tell if the mouseup was part of a drag or just a "click"?