如何获取谷歌地图“信息窗口内容”在外部div? [英] How to get the google map "info window content" on external div?

查看:112
本文介绍了如何获取谷歌地图“信息窗口内容”在外部div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正面临显示谷歌地图信息窗口以及更改外部div上的地图图标的问题



两者的组合显示信息窗口并更改地图上的标记图标正在崩溃信息窗口



此更改在IE 10中不支持,并且地图未在IE9中显示



你能尽快给我帮助吗。

解决方案

如果它有任何用处,这就是我已经实施过的: -











< title> ;我的网站



type =text / javascript& gt;





这里的文字









var locations = [

[ 'Point 1',54.918356, -1.415040,'你在click.html'上的文件链接',

['Point 2',50.015866,14.525587,'你在click.html上的文件链接'],

['Point 3',52.230204,21.000769,'你在click.html'上的文件链接',

['Point 4',59.907114,30.398900,'你在click.html上的文件链接'] ,





];



var map = new google.maps .Map(document.getElementById('map'),{

zoom:3,

center:new google.maps.LatLng(27.088825,14.465118),
mapTypeId:google.maps.MapTypeId.ROADMAP,

streetViewControl:false,

mapTypeControl:false

});



var infowindow = new google.maps.InfoWindow({maxWidth:100});



var marker;



for(i = 0;我& lt; locations.length; i ++)

{

marker = new google.maps.Marker({

position:new google.maps.LatLng(locations [i] [1],location [i] [2]),

icon:'images / beachflag.png',

map:map

});



google.maps.event.addListener(标记,'点击',(功能(标记,i){

返回function(){

window.open(locations [i] [3],'_ self');

}

})(marker ,i));

google.maps.event.addListener(marker,'mouseover',(function(marker,i){

return function(){

infowindow.setContent(locations [i] [0]);

infowindow.open(map,marker);

maxWidth:100
}

})(标记,i));

}





We are facing issue with displaying google map "info window" and also changing map icon on external div

Combination of the both displaying the Info window and changing the marker icon on the Map is crashing the info window

This change is not supporting in IE 10 and Map is not displaying in IE9

Can you assist me as soon as possible.

解决方案

This is along the lines I have implemented if it is of any use :-





<title>My Site

type="text/javascript"&gt;


Your text here





var locations = [
['Point 1', 54.918356, -1.415040,'your file link on click.html'],
['Point 2', 50.015866, 14.525587,'your file link on click.html'],
['Point 3', 52.230204, 21.000769,'your file link on click.html'],
['Point 4', 59.907114, 30.398900,'your file link on click.html'],


];

var map = new google.maps.Map(document.getElementById('map'), {
zoom: 3,
center: new google.maps.LatLng(27.088825, 14.465118),
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControl: false
});

var infowindow = new google.maps.InfoWindow({ maxWidth: 100});

var marker;

for (i = 0; i &lt; locations.length; i++)
{
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
icon: 'images/beachflag.png',
map: map
});

google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
window.open(locations[i][3], '_self');
}
})(marker, i));
google.maps.event.addListener(marker, 'mouseover', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
maxWidth: 100
}
})(marker, i));
}



这篇关于如何获取谷歌地图“信息窗口内容”在外部div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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