0

我正在使用biostall 的 codeigniter 谷歌地图库来显示我的谷歌地图。我按照说明显示信息窗口并在页面上正确显示地图。目前信息窗口仅在单击指针时打开。到目前为止的进展就像演示中显示的紫色图标。点击快速演示

我无法让信息窗口默认打开。请指教。

配置代码如下:

// map
$this->load->library('googlemaps');
// Initialize our map. Here you can also pass in additional parameters for customising the map (see below) 
$config['center'] = '37.4419, -122.1419';
$config['zoom'] = '14';
$config['map_width'] = '500px';
$this->googlemaps->initialize($config);

// set markers
$marker = array();
$marker['position'] = '37.4419, -122.1419';
$marker['infowindow_content'] = '<b>We are here!!</b>;
$marker['animation'] = 'DROP';
$this->googlemaps->add_marker($marker);

// Create the map. This will return the Javascript to be included in our pages <head></head> section and the HTML code to be placed where we want the map to appear. 
$data['map'] = $this->googlemaps->create_map();
4

2 回答 2

2

我遇到了同样的问题,您的模拟点击解决方案效果很好。但是我的信息窗口太大/我的缩放太高/我的 map-div 太小,所以 map-div 剪裁了信息窗口。所以我稍微修改了你的codeline,这个问题也解决了。

$config["onload"] = 'window.setTimeout("google.maps.event.trigger(marker_0, \'click\');",300);';
于 2012-10-11T14:54:23.440 回答
0

感谢您使用我的图书馆。尝试将其添加到 $config 参数列表中:

$config['onload'] = "google.maps.event.trigger(marker_0, 'click');";

这将基本上模仿页面加载时对第一个标记的点击。

我没有对此进行测试,但它应该可以工作。如果它不让我知道,我会仔细看看。

祝你好运!

于 2012-07-18T12:19:36.770 回答