Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop google maps markers from having pointer cursor style on hover?

How can I stop my google maps markers from having the pointer cursor style on hover? Currently the markers behave like links in that if you hover the mouse over them the cursor changes to a hand.

Here is the code that creates the marker:

function addMarkerLargeMap(latlng, myTitle, html, price) {
    markers.push(new google.maps.Marker({
        position: latlng, 
        map: map,
        title: myTitle, 
         icon: "path-to-my-icon.png",  
         html: "<div style='width:100px;height:auto'>" + html + "</div>",

      }));
like image 523
Evanss Avatar asked May 23 '13 14:05

Evanss


1 Answers

Set clickable to false in the marker options

function addMarkerLargeMap(latlng, myTitle, html, price) {
    markers.push(new google.maps.Marker({
        position: latlng, 
        clickable: false,
        map: map,
        title: myTitle, 
         icon: "path-to-my-icon.png",  
         html: "<div style='width:100px;height:auto'>" + html + "</div>",
      }));

Alternatively, you can set the cursor property in the marker options, if you want to use a specific type of cursor instead of the default. e.g.

cursor: 'crosshair'

Although this only seems to work if the marker is clickable.

like image 145
duncan Avatar answered Oct 20 '22 21:10

duncan