谷歌地图无法正常运行IE11 [英] Google maps not working IE11

查看:82
本文介绍了谷歌地图无法正常运行IE11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注意到Google MapsIE 11中不起作用,但是在ChromeFirefox中完全可以正常工作.有什么明显的我忽略了使其起作用的东西吗?您可以在此处检查实时版本:链接

I've just noticed Google Maps isn't working in IE 11, but works completely fine in Chrome and Firefox. Is there something obvious that I overlooked to get it to work? You can check for a live version here: link

function initialize() {


var myLatlng = new google.maps.LatLng(51.035113, 3.715104);
var mapOptions = {
    zoom: 15,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

var marker = new google.maps.Marker({
    position: myLatlng,
    icon: "img/marker.png"
});
marker.setMap(map);
}
google.maps.event.addDomListener(window, 'load', initialize);

HTML

<div id="map-canvas"></div>

推荐答案

我认为可能是因为样式表.

I think it might be because of the style sheet.

根据此网站

IE需要知道地图的大小,以确保已设置

IE needs to know the size of the map ensure that it has been set

如果您为此示例代码,它将在IE下停止工作.我想同样的问题也会引起您的问题.

if you took out the style sheet for this sample code, it would stop working under IE. And I would assume the same issue caused your problem.

这篇关于谷歌地图无法正常运行IE11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆