2013-07-10 44 views
1

首先我是JS的新手,所以如果这是一项简单的任务,请耐心等待。在jQuery Mobile Panel中显示geoJSON属性

我正在使用存货LeafletJS popup bubble来显示我的geoJSON中的属性。但是,我想利用jQuery Mobile Panel在单击时显示geoJSON文件中的属性,它与OpenLayers示例here类似。提前致谢!

UPDATE:

这里是我使用加载以GeoJSON以及股票弹出从单张的JS:

$.getJSON(dict[geoJSON Variable Goes here], 
    function(data){ 
    L.geoJson(data, { 
     style: style, 
     onEachFeature: function (feature, layer){ 
     if (feature.properties.SOMETHING == 0){ 
      return layer.bindPopup("<b><em>" + feature.properties.Name + "</em> LABEL<br />LABEL</b>");} 
      else if (feature.properties.Attacks == 1){ 
        return layer.bindPopup("<b><em>" + feature.properties.Name + "</em> LABEL<br />" + feature.properties.SOMETHING + " label</b>");} 
      else { 
        return layer.bindPopup("<b><em>" + feature.properties.Name + "</em> LABEL<br />" + feature.properties.SOMETHING + " label</b>"); 
          } 
         }, 
        }).addTo(GROUPLAYER FOR LAYER ON/OFF); 
       }); 

我使用jQuery Mobile的显示多个图表现在一切正常,但geoJSON有很多数据,我需要显示,所以任何帮助,这将不胜感激。

+0

u能告诉我们一些代码? – krishgopinath

回答

0

是的,有可能。

只需使用:

marker.on("click",popMobilePanel); 

function popMobilePanel(event){ 
    //make your modal appear 
} 
+0

不会只适用于简单的标记吗?不是您需要'onEachFeature'的geoJSON? –

+0

对不起。我用标记查看了您的开放图层示例,并且我忘记了您正在使用geojson。我会更新我的答案。 –