我使用以下函数来设置弹出窗口的大小。但是,我注意到弹出窗口的大小总是超过我设置的大小,左边有右边距(见下文)。
我的代码有问题吗?
function onFeatureSelect(feature) {
selectedFeature = feature;
mydescription='<a href="' + feature.attributes.path + '">' + '<div class="visual">' + feature.attributes.image + '</div>' + '<div class="textual"><h2 class="title">' + feature.attributes.title + '</h2>' +'<div class="description">' + feature.attributes.description + '</div></div></a>';
popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(500,300), mydescription , null, true, onPopupClose);
popup.autoSize = true;
popup.panMapIfOutOfView = false;
feature.popup = popup;
map.addPopup(popup);
}
答案 0 :(得分:1)
只需设置popup.autoSize = false;
,弹出窗口将为500px X 300px