simultaneous 'click' and 'mouseover' events on Google Maps marker


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function createMarker(point, id, name, address, rooms_sale, rooms_rent ) {
  2. var marker = new GMarker(point);
  3. marker.value = id;
  4.  
  5. GEvent.addListener(marker, "click", function() {
  6. console.log('You clicked on ID ' + id);
  7. });
  8.  
  9. GEvent.addListener(marker, "mouseover", function() {
  10. var pointInfo = '<h2 style="margin: 0 0 .5em 0;">' + name + '</h2><p><strong>' + address + '</strong><br />' + rooms_sale + ' habitaciones de venta<br />' + rooms_rent + ' habitaciones de alquiler.</p>';
  11. marker.openInfoWindowHtml(pointInfo);
  12. });
  13.  
  14. return marker;
  15. }

URL: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/fd9c388fb2af590f/bf715966427ad869?lnk=gst&q=mouseover+click+event+problem#bf715966427ad869

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.