我正在构建一个 Google 地图应用程序,我想读出元数据,如指定的那样schema.org http://schema.org/LocalBusiness,从我的 HTML 绘制我的地图标记。
例如:
<li itemscope="itemscope" itemtype="http://schema.org/LocalBusiness">
...some html...
<div class="geo" itemprop="geo" itemscope="itemscope" itemtype="http://schema.org/GeoCoordinates">
<meta itemprop="latitude" content="43.681505" />
<meta itemprop="longitude" content="-79.294455" />
</div>
</li>
有没有一种简单的方法可以查询纬度和经度值,而无需循环遍历所有内容?
你试过这个吗?
jQuery(function($){
var latitude = $('.geo meta[itemprop="latitude"]').attr("content");
var longitude = $('.geo meta[itemprop="longitude"]').attr("content");
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)