我正在使用 JQuery Vector Map 加载 svg 文件,但我得到以下
Uncaught TypeError: Cannot read property 'width' of undefined
事实上,问题在于它无法从 svg 文件中读取。有人知道 $('#africa').vectorMap();
阅读它需要做什么。
<html>
<head>
<title>Testing Map</title>
<script src="jquery.vector-map/jquery-1.6.min.js" type="text/javascript"></script>
<link href="jquery.vector-map/jquery.vector-map.css" media="screen" rel="stylesheet" type="text/css" />
<script src="jquery.vector-map/jquery.vector-map.js" type="text/javascript"></script>
<script type="text/javascript">
$(function()
{
$('#africa').vectorMap();
});
</script>
</head>
<body>
<div id="africa">
<embed src="africa.svg"/>
</div>
</body>
</html>