小编Med*_*ise的帖子

多个Google Maps infowindow

目前我有一个谷歌地图,将在我的数据库中显示地图上的一些标记...我想在用户点击标记时添加一个信息窗口.

我让它工作,但问题是它只显示在最后加载的标记上,为什么会这样?

这是生成标记和infowindow的代码.

<script type="text/javascript">
function initialize() {
    var myOptions = {
        zoom: 3,
        center: new google.maps.LatLng(41.850033, -87.6500523),
        disableDefaultUI: true,
        navigationControl: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    setMarkers(map, offices);
}


/**
 * Data for the markers consisting of a name, a LatLng and a zIndex for
 * the order in which these markers should display on top of each
 * other.
 */
var offices = [<cfoutput>#officeList#</cfoutput>];

function setMarkers(map, locations) {
    // Add markers to the map …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

google-maps ×1

javascript ×1