如何在谷歌地图中制作更大的信息窗口?

时间:2014-03-27 13:05:59

标签: javascript html google-maps

我试图让窗户变得更大,以便我可以将来自twitter的新闻源放入其中。我搞砸了一些内联样式试图使宽度和高度更大,无法让它工作,这是迄今为止代码iv所做的。

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    <script>
function initialize() {
  var lnl = new google.maps.LatLng(33.8564199,-117.3610477);
  var opt = {
    zoom: 6,
    center: lnl
  }
  var poop = '<div id="poop2" >' + '<a class="twitter-timeline" href="https://twitter.com/GreekTheatreLA" data-widget-id="448463912984256512">Tweets by @GreekTheatreLA</a>' + '</div>';
  var map = new google.maps.Map(document.getElementById('map-props'), opt);
  var infowindow = new google.maps.InfoWindow({
    content:'<p id="hook"><a class="twitter-timeline" href="https://twitter.com/GreekTheatreLA" data-widget-id="448463912984256512">Tweets by @GreekTheatreLA</a></p>'
});

  var griff = new google.maps.LatLng(34.1183438,-118.3003646);
  var griff_mark = new google.maps.Marker({
      position: griff,
      animation: google.maps.Animation.DROP,
      title: "Griffith Observatory"
  });

  google.maps.event.addListener(griff_mark, 'click', function(){
    infowindow.open(map, griff_mark);
    });

1 个答案:

答案 0 :(得分:0)

将maxWidth添加到infowindow中的代码,如下所示。

var infowindow = new google.maps.InfoWindow({
content:'<p id="hook" style="height:200px; width: 800px;"><a class="twitter-timeline" href="https://twitter.com/GreekTheatreLA" data-widget-id="448463912984256512">Tweets by @GreekTheatreLA</a></p>',
maxWidth: 200
});