我正在努力让kmltree工作。正在加载kmz,但树不会展开以显示子元素。此外,他没有出现正确的文件夹图标。可能有关系?
有人看到我可能做错了吗?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Simple Example</title>
<script src="http://www.google.com/jsapi?key=ABCD"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!-- earth-api-utility-library dependencies -->
<script src="http://geojs.googlecode.com/svn/trunk/dist/geo.pack.js"></script>
<script src="http://earth-api-utility-library.googlecode.com/svn/trunk/extensions/dist/extensions.pack.js">
</script>
<!-- kmltree source files -->
<link rel="stylesheet" href="../dist/kmltree.css" media="screen">
<script src="../dist/kmltree.min.js"></script>
<script>
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
var gex = gex = new GEarthExtensions(ge);
var tree = kmltree({
url: 'http://kmltree.googlecode.com/hg/examples/kml/hello.kml',
gex: gex,
mapElement: $('#map3d'),
element: $('#tree'),
});
tree.load();
}
function failureCB(errorCode) {
alert('failed to load plugin');
}
$(document).ready(init);
</script>
</head>
<body>
<div id="tree" style="float:left; width:300px; height: 400px;"></div>
<div id="map3d" style="float:left; height: 400px; width: 600px;"></div>
</body>
</html>
答案 0 :(得分:0)
我遇到了同样的问题并通过调整“kmltree.css”文件中所有“images / ..”链接的路径到我的实际文件夹设置来解决它,例如如果将原始“images”和“css”文件夹放在根目录中,则必须将路径更改为“../ images ..”。