gpt4 book ai didi

javascript - usmaps.js 事件绑定(bind)

转载 作者:行者123 更新时间:2023-12-03 10:17:03 25 4
gpt4 key购买 nike

我试图找出这段代码,但我不能。我曾多次尝试破译这一点。有人可以帮我吗?

    $('#map').usmap({
<event>State: {
'MD' : function(event, data) {
console.log('You interacted with the state of Maryland');
}
}
});

我希望这是一个点击事件。

最佳答案

文档显示了这一点:

$('#map').usmap({
// The click action
click: function(event, data) {
$('#clicked-state')
.text('You clicked: '+data.name)
.parent().effect('highlight', {color: '#C7F464'}, 2000);
}
});

你试过这样吗?

编辑:

$('#map').usmap({
clickState: {
'NY' : function(event, data) {
console.log('You interacted with the state of Maryland');
}
}
});

这样您就只能点击一个州。

关于javascript - usmaps.js 事件绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29826413/

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