【发布时间】:2014-11-04 22:15:11
【问题描述】:
我使用 Mapplace.js,一个用于 jQuery 的 Google Maps Javascript 插件。 在一个插件中有一个功能可以在地图上显示标记。
//triggers to show a location in map
Maplace.prototype.ViewOnMap = function (index) {
//view all
if (index === this.view_all_key) {
this.o.beforeViewAll();
this.current_index = index;
if (this.o.locations.length > 0 && this.o.generate_controls && this.current_control && this.current_control.activateCurrent) {
this.current_control.activateCurrent.apply(this, [index]);
}
this.oMap.fitBounds(this.oBounds);
this.CloseInfoWindow();
this.o.afterViewAll();
//specific location
} else {
index = parseInt(index, 10);
if (typeof (index - 0) === 'number' && index > 0 && index <= this.ln) {
try {
google.maps.event.trigger(this.markers[index - 1], 'click');
} catch (err) {
this.debug('ViewOnMap::trigger', err.stack);
}
}
}
return this;
};
我尝试调用此方法但无济于事:
<a href="javascript:Maplace.prototype.ViewOnMap(2)">Link</a>
如何通过带键的链接调用?
【问题讨论】:
标签: javascript jquery google-maps jquery-plugins