Thursday, October 20, 2011

Adding a tooltip to marker

A common thing one might want to do is to add a tooltip to the marker. The tooltip is displayed when a user hovers with the mouse pointer over the marker. This is easily done by adding the property title to the marker options object.
Since this marker won’t be clickable I want to somehow indicate this. That is done by setting the property clickable to false. This results in that the mouse cursor won’t change on hover.

var marker = new google.maps.Marker({
  position: new google.maps.LatLng(56.8848, 14.7730),
  map: map,
  title: 'My workplace',
  clickable: false
}); 
 
Hope this helps! 

www.svennerberg.com
 
Read more 

Displaying jquery popup when clicking on an image link in infowindow
Working with a simple infowindow in google map

Add markers to Google Maps

Multitab infowindow in Google Map V3
Embedding a google map to the web page

 

1 comments:

Phạm Anh Tuấn said...

thanks for sharing this article ;))

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews