在Ghost帖子中悬挂javascript地图(amChart)

时间:2015-10-17 13:07:15

标签: javascript php amcharts ghost

我正在尝试将一个amChart地图添加到我在Ghost上的一个帖子中,但它似乎无法正常工作。我在PHP中测试了代码,它运行得很好。

<script src="http://www.amcharts.com/lib/3/ammap.js" type="text/javascript"></script>
<script src="http://www.amcharts.com/lib/3/maps/js/worldHigh.js" type="text/javascript"></script>
<div id="mapdiv" style="width: 850px; height: 515px; margin-left:auto;margin-right:auto;" align="center"></div>
<script type="text/javascript">

var map;

AmCharts.ready(function() {

map                 =new AmCharts.AmMap();

map.pathToImages    ="http://www.amcharts.com/lib/3/images/";

map.panEventsEnabled=true;

map.backgroundColor ="#FFFFFF";

map.backgroundAlpha =1;

map.zoomControl.buttonFillColor = "#5EB7DE";

map.zoomControl.buttonRollOverColor = "#88CAE7";

map.zoomControl.panControlEnabled =false;

map.zoomControl.zoomControlEnabled=true;



var dataProvider    ={

mapVar          : AmCharts.maps.worldHigh,

getAreasFromMap : true,

areas           : [

{ id: 'AT', showAsSelected: true },

{ id: 'FR', showAsSelected: true },

{ id: 'DE', showAsSelected: true },

{ id: 'GR', showAsSelected: true },

{ id: 'IT', showAsSelected: true },

{ id: 'NL', showAsSelected: true },

{ id: 'PT', showAsSelected: true },

{ id: 'ES', showAsSelected: true },

{ id: 'CH', showAsSelected: true },

{ id: 'TR', showAsSelected: true },

{ id: 'GB', showAsSelected: true },

{ id: 'US', showAsSelected: true },

{ id: 'MW', showAsSelected: true },

{ id: 'MA', showAsSelected: true },

{ id: 'MT', showAsSelected: true }

]

};



map.dataProvider    =dataProvider;



map.areasSettings   ={

autoZoom             : false,

color                : "#CDCDCD",

colorSolid           : "#5EB7DE",

selectedColor        : "#5EB7DE",

outlineColor         : "#666666",

rollOverColor        : "#88CAE7",

rollOverOutlineColor : "#666666"

};



map.write("mapdiv");

});

</script>

看起来应该是这样的:

read more here

我做错了什么?其他JS似乎工作正常。

0 个答案:

没有答案