On Jan 8, 5:16 am, Muzza <[email protected]> wrote:
> However for some reason when I click on another location point in my
> list It does not always move the marker.

It's because now, when the infoWindow is open, your marker do not get
swapped between 'hot' and 'cold', and that means that you try to oopen
an infoWindow on a marker that has been removed.
Instead of swapping markers every time, you can create one single hot
marker and reposition it as needed on top of the corresponding cold
marker.

To do that:
1. Remove the hmarkers array and every reference to it.
2. Create the hoticon.
3. Create one single 'hot' marker as a global variable. (make sure the
hoticon has been created before the marker)
var hotMarker = new GMarker(new GLatLng(0,0), {icon:hotIcon});

4. Instead of adding and removing markers, in the mouseover/mouseout
event handlers, simply reposition the hot marker to the correct
location and show/hide.
Now, since you're no longer adding and removing markers, you don't
need to check if the infoWindow is open.

function mymouseover(i) {
  hotMarker.setLatLng(cmarkers[i].getLatLng());
  hotMarker.show();
}
function mymouseout(i) {
  hotMarker.hide();
}

5. finally, in the click event handler, open the infowindow on the
cold marker instead of the hot one
function myclick(i) {
  cmarkers[i].openInfoWindowHtml(htmls[i]);
}

--
Marcelo - http://maps.forum.nu
--


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to