title: Click and Hold Event for Google Maps API
body: <p>How can I go about having a click and hold event for Google Maps API? I am using <code>setTimeout</code> on a <code>click</code> event, but it does not work that great.</p>
  
  <p>When I click and hold for 5 seconds on first try, it works great as the user is displayed with an alert message. But after the first try, it starts to show the alert message as you pan or zoom the map.</p>
  
  <pre><code>var map;
  
  function initialize() {
      var mapOptions = {
          zoom: 8,
          center: new google.maps.LatLng(-34.397, 150.644)
      };
      map = new google.maps.Map(document.getElementById('map-canvas'),
      mapOptions);
  
      google.maps.event.addListener(map, 'click', function() {
          setTimeout(function() {
              alert("Hello, World.");
          }, 5000);
      });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>
  
  <p>You can try it out <a href="http://jsfiddle.net/t8hc0xte/" rel="nofollow">here</a>.</p>