title: Google Maps: Center Auto-Opening infoWindow
body: <p>I have an auto-opening infoWindow that I'd like to center on my Google Map.</p>
  
  <p>I don't want to center on the marker itself, but the marker PLUS the infoWindow, as it would do automatically if the box when clicked open rather than opened by default.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>    &lt;script&gt;
      function initMap() {
      var occ = {lat: 45.5280879, lng: -122.6630186};
      var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 14,
      draggable: false,
      scrollwheel: false,
      center: occ
      });
      var contentString = '&lt;div id="content" style="font-family: Poppins, sans-serif; padding: 1em;"&gt;'+
      '&lt;div id="siteNotice"&gt;'+
      '&lt;/div&gt;'+
      '&lt;h4 style="margin-bottom: .125em;"&gt;The Oregon Convention Center&lt;/h4&gt;'+
      '&lt;p&gt;777 NE Martin Luther King Jr Blvd&lt;br&gt;'+
      'Portland, OR 97232&lt;br&gt;'+
      '&lt;a href="https://www.google.com/maps/dir//Oregon+Convention+Center,+777+NE+Martin+Luther+King+Jr+Blvd,+Portland,+OR+97232,+United+States/@45.5280879,-122.6630186,15z/data=!4m12!1m3!3m2!1s0x0:0x610cf37babf5b9df!2sOregon+Convention+Center!4m7!1m0!1m5!1m1!1s0x5495a0adc5ff1af5:0x610cf37babf5b9df!2m2!1d-122.6630186!2d45.5280879" target="_blank"&gt;Get directions&lt;/a&gt;&lt;/p&gt;'+
      '&lt;/div&gt;';
      var infowindow = new google.maps.InfoWindow({
      content: contentString,
      pixelOffset: new google.maps.Size(0, 15),
      });
  
      var marker = new google.maps.Marker({
      position: occ,
      map: map,
      title: 'The Oregon Convention Center',
      });
  
      infowindow.open(map, marker);
  
  
      google.maps.event.addDomListener(window, "resize", function() {
      var center = map.getCenter();
      google.maps.event.trigger(map, "resize");
      map.setCenter(center);
      });
      }
      &lt;/script&gt;
  </code></pre>
  
  <p>Fiddle: <a href="http://jsfiddle.net/kz1hnec0/" rel="nofollow">http://jsfiddle.net/kz1hnec0/</a></p>
  
  <p>How do I do this?</p>