简体   繁体   English

Google.maps.Map Javascript API V3与jquery兼容

[英]Google.maps.Map Javascript API V3 compatibilty with jquery

I am trying to figure out why this will work by adding a map on a div of id="google_map" 我试图通过在id =“google_map”div上添加地图来弄清楚为什么会这样做

map = new google.maps.Map(document.getElementById("google_map"), googleMapOptions);

but this wont work 但这不会奏效

var our_map = $("#google_map");
map = new google.maps.Map(our_map, googleMapOptions); 

I get this console error on firebug 我在firebug上遇到此控制台错误

TypeError: Argument 1 of Window.getComputedStyle does not implement interface Element.


...(a,b,c){c=c&&1==b;Jt.H?Yn(a[w],c?"":b):(b="alpha(opacity="+Jd(100*b)+")",rn(a[w]...

Map constructor expect Node as the first parameter: Map(mapDiv:Node, opts?:MapOptions) . Map构造函数期望Node作为第一个参数: Map(mapDiv:Node,opts?:MapOptions)

Instead of 代替

map = new google.maps.Map(our_map, googleMapOptions); 

you have to use 你必须使用

map = new google.maps.Map(our_map[0], googleMapOptions); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM