我正在使用 Google Maps PHP API,我需要更改弹出的“infoWindow”的宽度,然后单击标记,我尝试了几种方法,但我失败了。我正在使用从 Internet 下载的一些 api,我正在使用函数 $MAP_OBJECT->addMarkerByCoords()。
function getCreateMarkerJS() {
$_output = "
function createMarker(map, point, title, html, icon, icon_shadow, sidebar_id, openers){
var marker_options = {
position: point,
map: map,
title: title};
if(icon!=''){marker_options.icon = icon;}
if(icon_shadow!=''){marker_options.shadow = icon_shadow;}
//create marker
var new_marker = new google.maps.Marker(marker_options);
if(html!=''){
".(($this->info_window)?"
google.maps.event.addListener(new_marker, '".$this->window_trigger."', function() {
infowindow.close();
infowindow.setContent(html);
infowindow.open(map,new_marker);
});
if(openers != ''&&!isEmpty(openers)){
for(var i in openers){
var opener = document.getElementById(openers[i]);
opener.on".$this->window_trigger." = function() {
infowindow.close();
infowindow.setContent(html);
infowindow.open(map,new_marker);
return false;
};
}
}
":"")."
if(sidebar_id != ''){
var sidebar = document.getElementById(sidebar_id);
if(sidebar!=null && sidebar!=undefined && title!=null && title!=''){
var newlink = document.createElement('a');
".(($this->info_window)?"
newlink.onclick=function(){infowindow.open(map,new_marker); return false};
":"
newlink.onclick=function(){map.setCenter(point); return false};
")."
newlink.innerHTML = title;
sidebar.appendChild(newlink);
}
}
}
return new_marker;
}
";
return $_output;
}