谷歌地图错误:对象功能(){return this.get(a)}没有方法'包含'

时间:2014-03-17 20:30:58

标签: javascript google-maps jquery-mobile google-maps-api-3 google-maps-markers

我正在尝试执行以下语句:

nowMap.getBounds.contains(mymarker.getPosition())

但它返回以下错误:

Object function (){return this.get(a)} has no method 'contains'

getBounds.contains调用在bounds_changed事件处理程序中执行,以确保map已准备就绪。我读到这可能是由于v3.14 api中的错误导致我升级到3.15并仍然收到错误。请注意,如果包含jquery-mobile page的{​​{1}}是我导航到的第一个map,则不会收到错误。

1 个答案:

答案 0 :(得分:0)

你有一个错字:

nowMap.getBounds.contains(mymarker.getPosition())

()后遗失getBounds。该行应该是:

nowMap.getBounds().contains(mymarker.getPosition())