2
我組建了一個世界地圖使用視差的拉斐爾地圖教程點擊洲:https://parall.ax/blog/view/2985/tutorial-creating-an-interactive-svg-map
我也跟着一步一步的一切,但一旦我加載頁面,我得到的唯一的大陸是我的第一個,歐洲。請幫我弄清楚我出錯的地方,謝謝!我很喜歡與Raphael等插件一起工作。讓我知道是否需要發佈更多信息。
下面是一個顯示問題我的小提琴: https://jsfiddle.net/Nimara/jut2c40t/
示例代碼(太大張貼座標):
var rsr = Raphael('map', '770', '505.3');
var continents = [];
//Europe
var europe = rsr.path("coordinates jabber, see fiddle")
europe.attr({'stroke-width': '0', 'stroke-opacity': '1','fill': '#000000'}).data('id', 'europe');
continents.push(Europe);
//Asia
var asia = rsr.path("coordinates jabber, see fiddle")
asia.attr({
'stroke-width': '0',
'stroke-opacity': '1',
'fill': '#000000'
}).data('id', 'asia');
continents.push(asia);
//North America
var north_america = rsr.path("coordinates jabber, see fiddle")
north_america.attr(
{
'stroke-width': '0',
'stroke-opacity': '1',
'fill': '#000000'
}).data('id', 'north_america');
continents.push(north_america);
//Africa
var africa = rsr.path("coordinates jabber, see fiddle")
africa.attr(
{
'stroke-width': '0',
'stroke-opacity': '1',
'fill': '#000000'
}).data('id', 'africa');
continents.push(africa);
//South America
var south_america = rsr.path("coordinates jabber, see fiddle")
south_america.attr(
{
'stroke-width': '0',
'stroke-opacity': '1',
'fill': '#000000'
}).data('id', 'south_america');
continents.push(south_america);
//Australia
var australia = rsr.path("coordinates jabber, see fiddle")
australia.attr(
{
'stroke-width': '0',
'stroke-opacity': '1',
'fill': '#000000'
}).data('id', 'australia');
continents.push(australia);
//Iterate through the regions and select continent to fill with color
for (var i=0; i<continents.length; i++) {
if (continents[i].data('id') == 'africa'){
continents[i].node.setAttribute('fill', 'red');
}
}
//NOT SO SURE I NEED THIS BOTTOM HALF. With or without it the problem persists.
XMLID_1209_.attr(
{
'id': 'XMLID_1209_',
'name': 'XMLID_1209_'
});
var rsrGroups = [XMLID_1209_];
XMLID_1209_.push(europe, asia, north_america, africa, south_america, australia);
這是我處理的地圖:http://www.amcharts.com/svg-maps/?map=continents
謝謝再次!
太感謝你了!我應該檢查開發者工具,我的壞。非常感謝你的截圖。你是最棒的〜 – Nimara