Making the Bing Map API Map responsive

前端 未结 2 429
北恋
北恋 2021-01-14 18:44

I am using Bing Map API v7 and I am trying to make it responsive. My initial idea was the typical

2条回答
  •  轮回少年
    2021-01-14 19:22

    You need to detect the window height with Javascript and then set the height dynamically on load as well as on resize. This is for Google map but it's the same premise.

    $(window).resize(function () {
    var screenH = $(document).height();
    var screenW = $(document).width();
    $('#map-canvas').css({
        width: screenW - listingsW,
    })
     google.maps.event.trigger(map, 'resize');
    
    });
    

提交回复
热议问题