On Sep 7, 3:25 pm, serogen <[email protected]> wrote:
> ok, now ive got the error script online
> :Shttp://yellowmed.com/de/stellenmarkt/studium
> hover on the list shall open the InfoWindowHtml on the googleMap but
> an error occurs
The issue is that you do not have function closure on your markers.
When you mouseover a name, it attempts to open an infoWindow on
myMarker[divider] -- but at that stage, after the loop has ended,
divider is 32. myMarker[32] doesn't exist.
Try changing this (lines 209 foll)
>>>
if(item['elemId']) {
GEvent.addDomListener( document.getElementById(item['elemId']),
'mouseover', function() {
GEvent.trigger(myMarker[divider], 'mouseover');
});
GEvent.addDomListener( document.getElementById(item['elemId']),
'mouseout', function() {
GEvent.trigger(myMarker[divider], 'mouseout');
});
<<<
to use a new global helper function, something like this:
function createListener(elm,index) {
GEvent.addDomListener(document.getElementById(elm),
"mouseover", function() {
GEvent.trigger(myMarker(index), "mouseover");
});
}
if (item['elemId']) { createListener(item['elemId'],divider) }
Doing that means that "divider" is fixed when the listener is created.
You've fallen into a variation of Pitfall Number Three in Mike's
marker example at http://econym.org.uk/gmap/basic1.htm
[I haven't included the mouseout events: you'll need to add those]
Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-api?hl=en
-~----------~----~----~----~------~----~------~--~---