0
我正在使用jquery和這個插件。 This是我目前有(底部實際問題):jQuery jVector地圖onRegionClick顯示相關信息
到目前爲止,我有以下代碼:
var properties = [];
jQuery.each(json['properties'],function(k,v){
properties.push({
name:v.name,
status:v.status,
color:v.color,
size:v.size,
price:v.price
});
});
console.log(properties);
這爲的getJSON它返回:
{
"land": {
"Long Land": {
"path": "M541.421,195.072 156.67,423.574 7.16,321.971 428.509,14.837 639.505,78.824 715.519,62.551 696.101,102.448 484.892,100.685 238.629,265.688 298.41,338.024 540.763,194.308 526.509,170.217 747.15,108.014 780.865,164.098 611.146,314.125",
"name": "Long Land"
}
},
"properties": {
"unit 1": {
"path": "M541.421,195.072 156.67,423.574 428.509,14.837 639.505",
"name": "unit 1",
"status": "Available",
"color": "#244df0",
"size": "3200",
"price": "300 000"
}
}
}
,然後console.log(屬性)我得到以下對象:
color "#244df0"
name "unit 1"
price "300 000"
size "3200"
status "Available"
然後我INIT jvectormap:
//START JVECTORMAP
jQuery('#twinvalley-map').vectorMap({
map: 'twin_valley',
normalizeFunction: 'polynomial',
backgroundColor: false,
onRegionClick:function (event, code, region){
console.log(code);
}
});
//START JVECTORMAP
然後最後的onRegionClick的console.log()我得到了相同的名稱,在這兩個以前的日誌.. '單元1'。
所以現在我的問題,我將如何獲得區域點擊數據的其餘部分?數據我的意思是:
color "#244df0"
name "unit 1"
price "300 000"
size "3200"
status "Available"
任何幫助非常感謝。
只是缺少在+,但執行console.log是,就是這樣!謝謝! –