I can't get the following script to work. I start out being able to
drag the marker. Once I click the map, the maker continues to be
draggable but the listener for dragstart and dragend stop working ion
FF3 and IE7. Does anyone have any advice?

function geoFinder(gLat,gLng,zoom) {
        /*create map*/
        var map = new GMap2(document.getElementById("mapCanvas"));
        var centerPoint = new GLatLng(gLat, gLng);
        map.setCenter(centerPoint, zoom);

        /*add controls*/
        map.setMapType(G_HYBRID_MAP);
        map.addControl(new GSmallMapControl());
        map.disableDoubleClickZoom();

        /*add draggable marker*/
        var marker = new GMarker(centerPoint, {draggable: true});
        map.addOverlay(marker);

        /*close infoWindow on dragstart*/
        GEvent.addListener(marker, "dragstart", function()
{map.closeInfoWindow();});

        /*show infoWindow on dragend*/
        GEvent.addListener(marker, "dragend", function() {
                centerPoint = marker.getPoint();
                map.panTo(centerPoint);
                marker.openInfoWindowHtml(infoWindow(centerPoint));
        });

        /*show infoWindow on map click*/
        GEvent.addListener(map, "click", function(overlay, centerPoint) {
                map.clearOverlays();
                marker = new GMarker(centerPoint, {draggable: true});
                map.addOverlay(marker);
                map.panTo(centerPoint);
                marker.openInfoWindowHtml(infoWindow(centerPoint));
        });
}

function infoWindow(thisPoint) {
        var thisLat = thisPoint.lat();
        thisLat = thisLat.toFixed(6); //Precision beyond the 6 decimal places
is ignored
        var thisLng = thisPoint.lng();
        thisLng = thisLng.toFixed(6); //Precision beyond the 6 decimal places
is ignored
        return '<div style="padding-top:20px;font-size:12px;font-
family:arial;">new GLatLng('+thisLat+', '+thisLng+')</div>';
}

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