如何启用信息Windows默认打开与CI谷歌地图库


How to enable Info Windows Open on Default With CI google map library

我正在使用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();

我遇到了同样的问题,您的模拟点击解决方案运行良好。但是我的信息窗口太大/我的缩放太高/我的mapdiv太小,所以mapdiv剪掉了信息窗口。所以我修改了你的代码行,这个问题也得到了解决。

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

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

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

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

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

祝你好运!