jquery.ui.maps带有多个标记和标签

jquery.ui.maps with multiple markers and labels

本文关键字:标签 ui maps jquery      更新时间:2023-09-26

我使用jquery.ui.maps,并从json填充标记。使用下面的代码,我看到了标记应该在的标签,但我在页面上只看到了一个标记。如果我注释掉'marker': MarkerWithLabel,那么我看到所有的标记,但没有标签。我需要做什么才能看到标签和标记?

$.each( result, function(i,marker) {
    $('#map_canvas').gmap('addMarker', { 
        'id': i,
        'bounds': true,
        'marker': MarkerWithLabel,
        'labelContent': '<a class="hint--top hint--always" data-hint="'+this.price+'">'+this.price+'</a>',
        'labelAnchor': new google.maps.Point(6, 10),
        'labelClass': "labels",
        'labelStyle': {opacity: 0.75},
        'labelInBackground': false,
        'position': new google.maps.LatLng(marker.latitude, marker.longitude)
    }).click(function() {
        $('#map_canvas').gmap('openInfoWindow', { 'content': marker.street_address_full }, this);
    });
});

感谢地理编码!问题是我使用的是旧版本的MarkerWithLabel。MarkerWithLabel 的问题