文本未显示在谷歌地图标记上的标签上

时间:2015-08-21 10:02:22

标签: javascript html5 google-maps google-maps-api-3

问题很简单,一切正常,唯一的问题是:
标记和标签显示在谷歌地图上,但标签文字没有显示, 这是我的完整代码:http://jsfiddle.net/abhbha/cd4h3yyo/3/

function initialize(lat1, long1) {
    var markers = [
    {
            "propid": "117",
            "title": " Title 1 ",
            "lat": "28.683441130339858000",
            "lng": "77.316357372033620000",
           },
            {
                "propid": "116",
                "title": " Title 2",
                "lat": "28.905853091546845000",
                "lng": "78.470265147912530000"
            },
            {
                "propid": "115",
                "title": " Title 3",
                "lat": "28.986857208298716000",
                "lng": "77.712208507287530000",
            }];

    var mapOptions = {
        center: new google.maps.LatLng(lat1, long1),
        zoom: 12,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
    };
    var infoWindow = new google.maps.InfoWindow();
    var map = new google.maps.Map(document.getElementById("gmap"), mapOptions);
    for (i = 0; i < markers.length; i++) {
        var data = markers[i]
        var myLatlng = new google.maps.LatLng(data.lat, data.lng);
        var marker = new MarkerWithLabel({
            position: myLatlng,
            map: map,
            //icon: '/img/sticker/empty.png',
            //shadow: '/img/sticker/bubble_shadow.png',
            //transparent: '/img/sticker/bubble_transparent.png',
            title: data.title,
            labelContent: " jhdgfjdgh ",
            labelClass: "labels",
            labelVisible: true,
            labelInBackground: false,
        });
    }
}

1 个答案:

答案 0 :(得分:2)

因为您似乎已经加载了过时版本的markerwithlabel.js
改为加载http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerwithlabel/src/markerwithlabel.js

<强> http://jsfiddle.net/wxtmjstw/