我正在从DB读取点作为JSON来在页面上创建地图标记和非结构化列表.添加一些代码以自定义列表元素后,地图停止在第一次请求时显示标记图标 - 直到发出页面重新加载.这是由于API超时吗?可以在加载地图后从数组构建列表对象,还是有其他方法来加速可能消除问题的代码?地图加载标记很好,加上这个标记(300+)的两倍,所以我知道问题是由于将格式添加到列表对象.不需要群集.此处提供该页面的演示版本
签了JS n00b.谢谢....... JSON POWERED GOOGLEMAP
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8">
var map;
var infoWindow = new google.maps.InfoWindow();
function initialize() {
var myLatlng = new google.maps.LatLng(49.57154029531499,-125.74951171875);
var myOptions = {
zoom: 8,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.TERRAIN,
streetViewControl: false
}
this.map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
} /* end initialize function */
<!-- load points from database into Locations JSON -->
$(document).ready(function () {
initialize();
$.getJSON("map-service.php?action=listpoints", function(json) {
if (json.Locations.length > 0) {
for (i=0; i<json.Locations.length; …Run Code Online (Sandbox Code Playgroud)