title: Preventing Google Maps Move After Displaying Infowindow
body: <p>I'm trying to display a infowindow on a Google Maps. It displays perfect, when you hover over a marker it loads up a infowindow but the map jumps to fit in the window. I don't want the map to move but rather infowindow set its position according to map. Booking.com has something like this.</p>
  
  <p><strong>EDIT:</strong> Added my code</p>
  
  <p>Here is the stripped down version of my code. I'm getting all the info from an <strong>AJAX service</strong> and this service returns <code>response</code> (which holds some more info too).</p>
  
  <pre><code>$.ajax({
      url: 'URL',
      dataType: "json",
      type: "GET",
      success: function(response) {
          // delete all markers
          clearOverlays();
  
          var infowindow = new google.maps.InfoWindow();
  
          for (var i = 0; i &lt; response.length; i++) {
              item = response[i];
  
              var marker = new google.maps.Marker({
                  position: new google.maps.LatLng(item.lat, item.lng),
                  map: map,
                  url: item.detail_url
              });
  
              markersArray.push(marker);
  
              // display infowindow
              google.maps.event.addListener(marker, "mouseover", (function(marker, item) {
                  return function() {
                      infowindow.setOptions({
                          content: 'SOME CONTENT HERE FOR INFOWINDOW'
                      });
  
                      infowindow.open(map, marker);
                  }
              })(marker, item));
  
              // remove infowindow
              google.maps.event.addListener(marker, 'mouseout', function() {
                  infowindow.close();
              });
  
              // marker click
              google.maps.event.addListener(marker, 'click', function() {
                  window.location.href = marker.url;
              });
          }
      }
  });
  </code></pre>
  
  <p>As you can see below, the first image shows the infowindow displayed at bottom of marker while second one shows the infowindow displayed on top of the marker. The map doesn't move but infowindow sets its position within the boundries of the map.</p>
  
  <p><img src="https://i.stack.imgur.com/AzqwF.jpg" alt="Infowindow bottom of marker">
  <img src="https://i.stack.imgur.com/x5U5p.jpg" alt="Infowindow on top of marker"></p>