2013-03-15 48 views
0

我想讓kmltree工作。 kmz正在加載,但樹不會展開以顯示子元素。此外,他正確的文件夾圖標不會出現。可能有關係嗎?
任何人看到我可能做錯了什麼?在「kmltree.css」文件kmltree看起來不對

<!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

我正好碰上了同樣的問題,並通過適應所有的路徑解決它「圖像/ ..」鏈接到我的實際文件夾的設置,例如如果將原始「圖像」和「css」文件夾放在根目錄中,則必須將路徑更改爲「../images ..」。