从jQuery Vector Maps获取选定国家的名称 [英] Get name of selected country from jQuery Vector Maps
本文介绍了从jQuery Vector Maps获取选定国家的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用jQuery Vector Maps.
Im trying to use jQuery Vector Maps.
一切正常,但我只是不知道如何获得被点击国家/地区的名称.我需要此名称才能在我的其他jQuery代码中使用该名称所在的国家/地区.
Everything works but i just dont know how i can get name of clicked country. I need this to use that name country in my different jQuery code.
以下是简单的文档: http://jvectormap.com/documentation/javascript-api-v1/jvm-worldmap/
我认为我将不得不使用:getMapObject
I think that i will have to use: getMapObject
但是我该如何使用呢?此getCode放在哪里?
But how i have to use it? Where put this getCode?
推荐答案
我是用这段代码完成的
$(function(){
$('#world-map').vectorMap({
backgroundColor: '#000',
map: 'world_map',
series: {
regions: [{
values: countryDamage,
scale: ['#FFEECF', '#FF2C2C'],
normalizeFunction: 'polynomial'
}]
},
onRegionClick: function(event, code){
var map = $('#world-map').vectorMap('get', 'mapObject');
alert(map.getRegionName(code));
}
});
});
这篇关于从jQuery Vector Maps获取选定国家的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文