4

マーカーに画像のコンテンツがありますが、幅が 600 ピクセルを超えると、Google マップは自動的に情報ウィンドウに水平スクロールを追加します..Google マップ V3 の情報ウィンドウの最大サイズは? 可能であれば、どのように最大サイズを拡張できますか?

650/700px以上は必要ありません..

ありがとう。

4

2 に答える 2

2

答えてくれてありがとうショーンミッキー。

あなたが言ったように、Googleマップは地図のサイズに応じてmaxWidth InfoWindowを自動的に設定しますが、私の場合は小さすぎます。多くの掘り下げの後、税関infoWindowsを使用してこれを回避する2つの方法を見つけました。

私はinfoBubbleを使用しており、私のニーズに完全に適合しています。

ありがとう。

于 2012-07-17T14:07:02.237 に答える
2

It's hard to tell without seeing your code, but it sounds like you may have placed your image within a DOM element that has a smaller width than the image? If you add the code you are using to define your info-window, your info-window-options, and your content to your question, it will be easier for others to give you more specific suggestions.

By default, an InfoWindowdev-guide is sized based on its content, which may be: text, HTML, or a DOM element. The best way to control the width of an InfoWindow is to place the content within a div and define a CSS style rule that explicitly defines a width for the div. When using the default sizing based on the size of the content, the maximum width of an InfoWindow is only limited by the width of your Map.

Your other option is the maxWidth property (measured in pixels) of the InfoWindowOptionsapi-doc object, which may be associated with an InfoWindowapi-doc by passing the options object to the info-window's constructor or by calling the InfoWindow.setOptions function after the info-window has been created. The InfoWindowOptions.maxWidth property will only be used if the options object has been associated with an info-window prior to calling the InfoWindow.open function. If you have a use case that requires you to change the value of maxWidth when you are changing the info-window's content, you must:

  1. Call InfoWindow.close
  2. Call InfoWindow.setOptions (passing in an InfoWindowOptions object with the new maxWidth value)
  3. Call InfoWindow.setContent
  4. Call InfoWindow.open to display the info-window on the Map

The Google Maps Developer's Guide includes an: example Map with the info-window maxWidth value set to 200 pixels. You may want to check that out if you are interested in using the maxWidth option and would like to explore a working Map that uses that option.

于 2012-07-14T00:23:14.293 に答える