Google Map not working with XHTML Doctype (Document Type)

前端 未结 4 2021
感情败类
感情败类 2021-02-06 04:33

Why on the earth there is always a chance that if we use \"Doctype\" with Google Maps, there will be a problem in showing the Google Map correctly?

In a recent case,

4条回答
  •  爱一瞬间的悲伤
    2021-02-06 05:14

    A quick solution could be to use it as follows:

    document.getElementById("google-map").style.height = $(window).height()+'px';

    before

    var map = new google.maps.Map(document.getElementById("google-map"), myMapOptions);

    It works pretty well with doctype. Tried and tested! :)

提交回复
热议问题