【发布时间】:2013-03-17 18:51:24
【问题描述】:
所以,
我已经设法使用 jVectorMap 插件显示自定义地图,并且我正在尝试添加自定义标记,但是当我按照此处的示例进行操作时:http://jvectormap.com/examples/mall/ 没有任何反应。我只是在代码中遗漏了一些简单的东西吗?
这是我在添加标记之前的代码:
//@code_start
$(function(){
$('#usmxmap').vectorMap({
map: 'map',
regionsSelectable: false,
markersSelectableOne: true,
backgroundColor: '#cfdbdd',
regionStyle: {
initial: {
fill: '#5e7073',
"fill-opacity": 1,
stroke: 'none',
"stroke-width": 0,
"stroke-opacity": 1
},
hover: {
fill: 'black'
},
selected: {
fill: 'yellow'
},
selectedHover: {
}
},
});
});
//@code_end
产生的 JsFiddle: http://jsfiddle.net/73aze/5/
这是我必须添加的标记:
//@code_start
$(function(){
$('#usmxmap').vectorMap({
map: 'map',
regionsSelectable: false,
markersSelectableOne: true,
backgroundColor: '#cfdbdd',
markers: [{
coords: [60, 110],
name: 'Escalator 1',
style: {fill: 'yellow'}
}],
regionStyle: {
initial: {
fill: '#5e7073',
"fill-opacity": 1,
stroke: 'none',
"stroke-width": 0,
"stroke-opacity": 1
},
hover: {
fill: 'black'
},
selected: {
fill: 'yellow'
},
selectedHover: {
}
},
});
});
//@code_end
正如您从 jsFiddle (http://jsfiddle.net/Z9u4T/3/) 中看到的那样,这只会导致地图消失,我无法确定我错过了什么。有什么想法吗?
马卡
【问题讨论】:
-
Uncaught TypeError: Cannot read property 'centralMeridian' of undefined- 这对你有什么意义吗?我之前没用过这个插件,但是控制台报错了。
标签: jquery jquery-plugins vector jvectormap