gpt4 book ai didi

jquery - JQVMap区域点击错误

转载 作者:行者123 更新时间:2023-12-03 22:43:50 24 4
gpt4 key购买 nike

我有一个像这样的 JQVMap 设置:

jQuery('#vmap').vectorMap({
map: 'usa_en',
enableZoom: true,
showTooltip: true,
selectedRegion: 'MO',
onRegionClick: function(element, code, region) {
var message = 'You clicked "'
+ region
+ '" which has the code: '
+ code.toUpperCase();
alert(message);
},
});

当我点击任何状态时,我都会收到上面设置的状态警报,但我也会在控制台中收到 JS 错误:

regionClickEvent is not defined

JQVMap 文件中的 if (!regionClickEvent.isDefaultPrevented()) { 行引发了错误。如何在不引发此错误的情况下单击状态?

最佳答案

找到解决办法,将jqvmap.js文件中的第466行修改为:

regionClickEvent = $.Event('regionClick.jqvmap');

jQuery(params.container).trigger(regionClickEvent, [code, mapData.pathes[code].name]);

关于jquery - JQVMap区域点击错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17459539/

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