2013-06-19 99 views
0

我正在使用谷歌地图api拉入地图到phonegap应用程序。地图工作正常,但我试图设置自定义标记,并遵循如下:https://developers.google.com/maps/documentation/javascript/overlays#Icons谷歌地图API设置标记保留字

您在哪里设置图像代码使用“锚点”设置。这是JavaScript中的保留字,如果它留在代码中,则JavaScript将失败。

我该如何解决这个问题?

var image = { 
url: 'images/beachflag.png', 
// This marker is 20 pixels wide by 32 pixels tall. 
size: new google.maps.Size(20, 32), 
// The origin for this image is 0,0. 
origin: new google.maps.Point(0,0), 
// The anchor for this image is the base of the flagpole at 0,32. 
anchor: new google.maps.Point(0, 32) 

};

回答

1

从什么时候锚定保留字?其次,如果你正在使用的对象保留字作为密钥,只需把它们放在引号像

{ 
'anchor': new google.maps.Point(0,32) 
} 
+0

感谢您的回答,但我不认为你需要降级我的答案。就像在我的ide里放置主播节目一样。我想弄清楚,如果它jQuery或jQuery的移动。并将其留在代码中停止运行。 –

+0

不需要IDE - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words – Adam