gpt4 book ai didi

javascript - 将光标样式更改为可单击标记的指针

转载 作者:行者123 更新时间:2023-11-28 07:43:44 25 4
gpt4 key购买 nike

我使用此处的 v3 map javascript api 创建了一个带有几个标记的 map 。
单击标记时,会显示所单击标记的信息气泡。

默认情况下,将鼠标悬停在标记上时光标样式保持不变。给用户留下标记不可点击的印象。

有没有办法将光标样式更改为指针( http://www.javascripter.net/faq/stylesc.htm )?
这样用户就会注意到该标记是可点击的。

最佳答案

如果您使用this例如,您可以看到 group 是一个 DOM 元素。因此,我们可以应用一个简单的javascript代码:

group.style.cursor = "pointer"

你的函数看起来像这样:

function addInfoBubble() {
var group = new H.map.Group();

map.addObject(group);
group.style.cursor = "pointer";
// add 'tap' event listener, that opens info bubble, to the group
group.addEventListener('tap', function (evt) {
// event target is the marker itself, group is a parent event target
// for all objects that it contains
var bubble = new H.ui.InfoBubble(evt.target.getPosition(), {
// read custom data
content: evt.target.getData()
});
// show info bubble
ui.addBubble(bubble);
}, false);

关于javascript - 将光标样式更改为可单击标记的指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27689518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com