I have an application with has worked for several years (and still
works) under v2.
There are markers on a map and when you click on the marker an
InfoWindow appears which contains text and two small images. If you
click on one of the images a large version of the image appears in a
window in the foreground.
In v3 the large image appears but immediately disappears behind the
window with the map.
An example of the HTML in the InfoWindow which displays the small
images is :-
<img style="width:200px; height:150px; cursor:pointer;" src="images/
summary2010/small/Lonely House.jpg" onclick="showlargepic('images/
summary2010/large/Lonely House.JPG')">
function showlargepic(picpath){
if(newwin != null) {newwin.close(); newwin=null;}
var
param='top=5,left=5,height=675,width=900,scrollbars=no,resizable=no,location=no,status=no,toolbar=no';
newwin=window.open(picpath,"largepic",param);
}
I have tried all sorts of things (such as newwin.focus() and playing
with zIndex) to get the new window to appear on the top. Without
success.
Strangely if I put exactly the same <img> definition in the <body>
just above the <div> that contains the map, it works fine.
Equally if I put exactly the same onclick on a button in the
InfoWindow it works fine.
<input type="button" value="Test" name="xxx"
onclick="showlargepic('images/summary2010/large/Lonely
House.jpg.JPG')">
I tried removing the cursor:pointer parameter in the <img> style but
this does not help.
Somehow, after clicking the small image in the InfoWindow, the focus
returns to the main window with the map in it and not the new window
with the large image.
This all works fine in v2, where exactly the same HTML is used but of
course the marker and InfoWindow are created in a different way. The
HTML is in markerinfo.
var marker = new GMarker(point, {icon: iconx,title: popup});
GEvent.addListener(marker, "click", function()
{marker.openInfoWindowHtml(markerinfo)});
Under v3 the code is
marker = new google.maps.Marker({
position: xpoint,
map: map,
icon: iconimage[xcol],
title: popup
});
google.maps.event.addListener(marker, 'click', function()
{showinfowindow(this);});
showinfowindow(xmarker) {
infowindow.setContent(markerinfo));
infowindow.open(map,xmarker);
}
(The above is a simplified version - in the production system there
are lots of markers all with different text and pictures, However the
simple version demonstrates the problem.)
Any help would be much appreciated.
David Burden
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.