Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 调整谷歌地图V3的信息窗口大小_Php_Google Maps Api 3 - Fatal编程技术网

Php 调整谷歌地图V3的信息窗口大小

Php 调整谷歌地图V3的信息窗口大小,php,google-maps-api-3,Php,Google Maps Api 3,我面临着巨大的问题,以解决信息窗口的大小。我想在信息窗口中显示一个图像块和一些文本信息,但在内容信息窗口大小增加后,我读了一些线程,但我的代码没有成功。谁能帮我整理一下吗 // Creating an object literal containing the properties // we want to pass to the map var options = { zoom: 5, center: new google.maps.LatLng(44.913990,

我面临着巨大的问题,以解决信息窗口的大小。我想在信息窗口中显示一个图像块和一些文本信息,但在内容信息窗口大小增加后,我读了一些线程,但我的代码没有成功。谁能帮我整理一下吗

// Creating an object literal containing the properties 
// we want to pass to the map  
var options = {  
  zoom: 5,  
  center: new google.maps.LatLng(44.913990, 15.205078),  
  mapTypeId: google.maps.MapTypeId.ROADMAP ,
  };
// Creating the map  
var map = new google.maps.Map(document.getElementById("map"), options);
// Creating a LatLngBounds object
var bounds = new google.maps.LatLngBounds();
// Creating an array that will contain the coordinates 
// for New York, San Francisco, and Seattle
  var content = [];
  var places = [];content.push('Some html');
  places.push(new google.maps.LatLng(44.913990, 15.205078));
// Creating a variable that will hold 
// the InfoWindow object
var infowindow;

// Looping through the places array
for (var i = 0; i < places.length; i++)
{
  // Adding the markers
  var marker = new google.maps.Marker({
    position: places[i], 
    map: map,
    icon: "/themes/garland/images/beach_icon_gmap.png"
  //  title: "Place number " + i
  });

  // Wrapping the event listener inside an anonymous function 
  // that we immediately invoke and passes the variable i to.
  (function(i, marker) {
    // Creating the event listener. It now has access to the values of
    // i and marker as they were during its creation
    google.maps.event.addListener(marker, "click", function() {

      // Check to see if we already have an InfoWindow  
      if (!infowindow) {
        infowindow = new google.maps.InfoWindow({
            maxWidth: 20,
            maxheight: 20
        });
      }

      // Setting the content of the InfoWindow
      infowindow.setContent(content[i]);

      // Tying the InfoWindow to the marker 
      infowindow.open(map, marker);

    });

  })(i, marker);

  // Extending the bounds object with each LatLng
  bounds.extend(places[i]);
}
// Adjusting the map to new bounding box
// map.fitBounds(bounds)
//创建包含属性的对象文字
//我们想通过地图
变量选项={
缩放:5,
中心:新google.maps.LatLng(44.91399015.205078),
mapTypeId:google.maps.mapTypeId.ROADMAP,
};
//创建地图
var map=new google.maps.map(document.getElementById(“map”),选项);
//创建LatLngBounds对象
var bounds=new google.maps.LatLngBounds();
//创建将包含坐标的数组
/纽约、旧金山和西雅图
var内容=[];
var位置=[];push('somehtml');
places.push(新的google.maps.LatLng(44.91399015.205078));
//创建一个将保持
//InfoWindow对象
var信息窗口;
//在places数组中循环
对于(变量i=0;i

任何帮助都将不胜感激。提前感谢。

我在代码中注意到的第一件事:
maxWidth
是传递给
InfoWindowOptions
构造函数的
InfoWindowOptions
对象的有效属性,但
maxheight
不是。您将无法将
InfoWindow
视为严格或严格的容器,尽管
maxWidth
将限制宽度。
InfoWindow
的大小总是能够包含所提供的任何内容。从API文档:

信息窗口将根据内容调整大小。立 内容的显式大小,将内容设置为具有 那个尺寸

也就是说,您可以通过定义CSS类并将样式规则应用于窗口内容来控制
信息窗口的大小、显示、颜色等。对内容采用CSS方法可以让您完全控制内容的大小,因为
InfoWindow
只是作为内容的容器。如果CSS规则导致内容大小正确,则您的
InfoWindow
将是正确的大小