[英]If there is a javascript error on the page, does google map not load?
I am using the Google Maps API. 我正在使用Google Maps API。 I get the Google Map by:
我通过以下方式获得了Google地图:
$map = $this->ci->gis->draw_map_position_by_lat_long($this->ci->profile_data['LocLat'],$this->ci->profile_data['LocLong']);
$this->ci->widgets['map']= $map;
Function: 功能:
public function draw_map_position_by_lat_long($lat = NULL , $long = NULL) {
$load['center'] = $lat . ',' . $long;
$load['map_height'] = "191px";
$this->ci->googlemaps->initialize($load);
$i = 0;
$marker = array();
$marker['position'] = $lat . ',' . $long;
$marker['draggable'] = 'TRUE';
$marker['ondragend'] = "dragmarker(this.getPosition().lat(),this.getPosition().lng())";
$this->ci->googlemaps->add_marker($marker);
$map = $this->ci->googlemaps->create_map();
$this->position_data = array('map' => $map);
return $this->position_data;
}
The map is every place in my app without any problem except one place. 地图是我应用程序中的每个地方,只有一个地方,没有任何问题。
The strange thing is when I print the map on server side in it is not shown. 奇怪的是,当我在服务器端打印地图时,其中未显示。
$map = $this->ci->gis->draw_map_position_by_lat_long($this->ci->profile_data['LocLat'],$this->ci->profile_data['LocLong']);
$this->ci->widgets['map']= $map;
pre($map);
like this: 像这样:
I checked in Firebug and no java-script errors
. 我签入了Firebug,
no java-script errors
。
Another strange thing I found is that when I remove one of my javascript files, the map loads perfectly, but it has no direct link with the Google Map. 我发现的另一件奇怪的事情是,当我删除一个javascript文件时,地图可以完美加载,但没有与Google Map的直接链接。 Also no javascript errors shown in Firebug.
在Firebug中也没有显示JavaScript错误。
That script is: 该脚本是:
jQuery(document).ready(function(){
jQuery('#photo-slider').bxSlider();
window.onload = createUploader;
});
I have no idea what is wrong, I am stuck here. 我不知道怎么了,我被困在这里。 Any suggestion will be appreciated.
任何建议将不胜感激。 Thanks
谢谢
The script is hogging the load
event, which can have the effect that the google map can't use it. 脚本占用了
load
事件,可能会导致Google Map无法使用该事件。 If you use the jQuery events instead of DOM events, several scripts can use the event. 如果您使用jQuery事件而不是DOM事件,则几个脚本可以使用该事件。
Try changing this: 尝试更改此:
jQuery(document).ready(function(){
jQuery('#photo-slider').bxSlider();
window.onload = createUploader;
});
to: 至:
jQuery(document)
.ready(function(){ jQuery('#photo-slider').bxSlider(); })
.load(createUploader);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.