信息窗口带有Clicked Marker的地图

时间:2013-05-02 07:29:18

标签: google-maps google-maps-api-3

我正在使用Google Map v3。 我需要在点击路线标记时在infowindow中显示Map。 目前,我的代码显示相应标记的地址。 Attched image is the example which I am trying to achive 在附图中,点击标记“B”,打开小地图,标记“B”居中。

如果有人有任何意见,请告诉我。

谢谢, 沙拉斯

Below is my code snippet....
waypoints array contains the 2 points 2 display (origin and destination)
// Code starts from here...
var origin = waypoints[0];
var destination = waypoints[1];

var mapOptions = {
        center: new google.maps.LatLng(-25, 133),
        zoom: 4,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

var map = new google.maps.Map(document.getElementById("mapCanvas"), mapOptions);
var directions = new google.maps.DirectionsService();
directions.route({
                    origin: origin,
                    destination: destination,
                    travelMode: google.maps.DirectionsTravelMode.DRIVING,
                    unitSystem: google.maps.DirectionsUnitSystem.METRIC
                }, function(result, status) {
                    if (status == google.maps.DirectionsStatus.OK) {
                        directionsDisplay = new google.maps.DirectionsRenderer();
                        directionsDisplay.setPanel(document.getElementById     ("drivingDirections"));
                        directionsDisplay.setMap(map);
                        directionsDisplay.setDirections(result);
                    }
                });

0 个答案:

没有答案