如何停止我的Google地图标记在悬停时使用指针光标样式?目前,标记的行为类似于链接,如果您将鼠标悬停在它们上方,则光标会变为手形。
以下是创建标记的代码:
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>",
}));
答案 0 :(得分:20)
在标记选项中将clickable设置为false
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>",
}));
或者,如果要使用特定类型的游标而不是默认值,可以在标记选项中设置cursor
属性。 e.g。
cursor: 'crosshair'
虽然只有标记 可点击时,这似乎才有效。
答案 1 :(得分:0)
#main_map img {cursor:default!important;}