【发布时间】:2011-11-30 08:01:16
【问题描述】:
我有一个谷歌地图。
还有一个信息窗口。
现在尺寸是标准的,里面有 r 个文本。
所以,我的老板让我增加它。
我们正在使用ektron CMS,因此我需要进入ektron workarea 并编辑map.js
即使是ektron,还是用google map。
我设法找出显示为信息窗口的部分。
这是弹出信息窗口并在里面显示信息的代码部分。
marker = new GMarker(point, icon);
var infoWindow = map.getInfoWindow();
GEvent.addListener(marker, "mouseover", function () {
if (EMap.SearchData != 'content') {
if (qlink && qlink.length > 0) {
_userTB = '<span>' + title + '</span>';
}
else {
_userTB = title;
}
var theHtml1 = '<div id="IW_' + markerid + '" style="overflow:auto;width:240px;height:100px;">' + markerid + '. ' + _userTB + _summarytxt + '<br/>' + EGlobal.Format(EMap.Geolocation, new Array('javascript:EMap.SetAddress(\'' + EGlobal.Replace(address, '#', ' ') + '\',\'to\');', 'javascript:EMap.SetAddress(\'' + EGlobal.Replace(address, '#', ' ') + '\',\'from\');')) + '</div>';
map.openInfoWindowHtml(theHtml1);
}
else {
var theHtml2 = '<div id="IW_' + markerid + '" style="overflow:auto;width:240px;height:100px;">' + markerid + '. <span><b>' + title + '</b></span><br/>' + _summarytxt + '<br/>' + EGlobal.Format(EMap.Geolocation, new Array('javascript:EMap.SetAddress(\'' + EGlobal.Replace(address, '#', ' ') + '\',\'to\');', 'javascript:EMap.SetAddress(\'' + EGlobal.Replace(address, '#', ' ') + '\',\'from\');')) + '</div>';
marker.openInfoWindowHtml(theHtml2);
}
});
我尝试在谷歌上搜索,发现这是一个人试图更改信息窗口大小的方式。
var infoWindow = map.getInfoWindow();
var point = new GLatLng(0,0);
var marker = new GMarker(point);
GEvent.bind(marker,”click”,marker,function() {
map.openInfoWindowHtml(this.getPoint(),this.address,{onOpenFn:function(){
infoWindow.reset(this.getPoint(),infoWindow.getTabs(),new GSize(200,200),null,null);
}});
});
全文在this site。
但我无法将它们合并为 1。
尤其是那个家伙正在使用带有 3 个参数的 map.openInfoWindowHtml(),而 ektron 正在使用只有一个参数的 marker.openInfoWindowHtml()。
知道如何完成这项工作吗? Tkz 很多。
而且.. 我对谷歌地图很陌生。所以,如果我的问题浪费了你的时间,请原谅我。
【问题讨论】:
标签: javascript google-maps google-maps-api-2 ektron openinfowindowhtml