title: How to define custom size on Google Map when using closures in event listeners
body: <p>I' am using Google Map to plot the marker and a small popup box that will appear when someone clicks on the market. Image is attached. By Default, Google has set fixed width of the Popup and I wanted to change its size. I was not able to anything on <a href="https://developers.google.com/maps/documentation/javascript/examples/event-closure" rel="nofollow noreferrer">Documentation</a>.</p>
  
  <p><strong>Below are my codes</strong></p>
  
  <pre><code>        &lt;script type="text/javascript"&gt;
    function initialize() {
      var mapOptions = {
        zoom: 5,
        center: new google.maps.LatLng(-14.306407, -170.695018),
        mapTypeId: google.maps.MapTypeId.TERRAIN
      };
      var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
  
              var voyagePlanCoordinates = [               
        new google.maps.LatLng(),
      ];
  
      var voyagePath&lt;?php echo $voyage_id; ?&gt; = new google.maps.Polyline({
        path: voyagePlanCoordinates,
        geodesic: true,
        strokeColor: "",
        strokeOpacity: 1.0,
        strokeWeight: 5
      });
      voyagePath.setMap(map);
      setMarkers(map, voyages);
    }
  
      var voyages = [];
  
      function setMarkers(map, locations) {
        var image = {
          url: '/wp-content/themes/theme/resources/images/marker.png',
          size: new google.maps.Size(20, 32),
          origin: new google.maps.Point(0,0),
          anchor: new google.maps.Point(0, 32)
        };
        for (var i = 0; i &lt; locations.length; i++) {
          var voyage = locations[i];
          var myLatLng = new google.maps.LatLng(voyage[1], voyage[2]);
          var marker = new google.maps.Marker({
              position: myLatLng,
              map: map,
              icon: image,
              title: voyage[0],
              zIndex: voyage[3]
          });
                  voyage_msg(marker, i);
        }
      }
              function voyage_msg(marker, num){
  
                  var message = [];
                  var infowindow = new google.maps.InfoWindow({
                      content: message[num]
              });
              google.maps.event.addListener(marker, 'click', function() {
              infowindow.open(marker.get('map'), marker);
          });
              }
              google.maps.event.addDomListener(window, 'load', initialize);
    &lt;/script&gt;
  </code></pre>
  
  <p>Please Help!</p>
  
  <p><img src="https://i.stack.imgur.com/KlN9u.png" alt="enter image description here"></p>