设置openlayers弹出窗口大小的正确方法是什么?

时间:2014-01-12 20:37:27

标签: javascript jquery openlayers

我使用以下函数来设置弹出窗口的大小。但是,我注意到弹出窗口的大小总是超过我设置的大小,左边有右边距(见下文)。

我的代码有问题吗?

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);
}

screenshot

1 个答案:

答案 0 :(得分:1)

只需设置popup.autoSize = false;,弹出窗口将为500px X 300px