2014-06-10 63 views

回答

0

您可以使用icon objectanchor屬性,併爲標記圖像添加所需的任何偏移量。

var iconObj = { 
    url: '/path/to/icon.png', //path to icon image 
    origin: new google.maps.Point(0, 0), //position of the image within a sprite 
    anchor: new google.maps.Point(25, 25), //position at which to anchor an icon in correspondance to the position of the marker 
}; 

var markerObj = new google.maps.Marker({ 
    position: point, 
    map: map, 
    icon: iconObj 
}); 

更新:

要回答你的第二個問題,「我在哪裏把這個正是我的代碼」 - 你應該把圖標作爲對象drivers數組而不是字符串。

Here's modified working version of your code

相關問題