Why close button is not displayed for info window opened on Baidu Map?

孤者浪人 提交于 2019-12-13 02:55:36

问题


I am trying to implement the Baidu Map on my website, everything is done well but the close button ( on right top ) for the infowindw doesn't appear.

Here is my JS code:

var map = new BMap.Map("baidu_map"),
        point = new BMap.Point(-77.0763679, 38.8901401),
        baiduMapZoom = 12,
        marker = new BMap.Marker(point, {icon: new BMap.Symbol(BMap_Symbol_SHAPE_POINT, {scale:1, fillColor:"red",fillOpacity:0.8})});
    map.addOverlay( marker );
    map.centerAndZoom(point, baiduMapZoom);

    var opts = {
            width : 180,
            height: 95,
            title : 'Rates Property',
            enableMessage:true
        },
        infoWindow = new BMap.InfoWindow('1325 North Pierce Street Arlington VA 22209', opts);
    marker.addEventListener("click", function(){
        map.openInfoWindow( infoWindow, point );
    });

    // Add a map type control
    map.addControl(new BMap.MapTypeControl({
        mapTypes:[
            BMAP_NORMAL_MAP,
            BMAP_HYBRID_MAP
        ]}));
    map.addControl(new BMap.NavigationControl());

Please help with what I am missing.

Note: Ref. used from this link but there is no such specific code for showing infowindow, still that map has infowindow with the close button on the right top.

来源:https://stackoverflow.com/questions/58185062/why-close-button-is-not-displayed-for-info-window-opened-on-baidu-map

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!