[OpenLayers-Users] Re: Weird popup behaviour in IE
JavierMR
javiersdevmail at ymail.com
Wed Oct 26 03:10:20 EDT 2011
It looks like the javascript code does not display correctly. I resend it.
function init() {
createMap();
createVectors();
}
var map = null;
/* Crear mapa */
function createMap(){
map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'}
);
map.addLayers([wms]);
map.zoomToMaxExtent();
};
function createVectors(){
var vectors3 = new OpenLayers.Layer.Vector("Vector Layer", {
styleMap: new OpenLayers.StyleMap({
"default": new OpenLayers.Style(OpenLayers.Util.applyDefaults({
externalGraphic: "http://openlayers.org/dev/img/marker-green.png",
graphicOpacity: 1,
rotation: -45,
pointRadius: 10
}, OpenLayers.Feature.Vector.style["default"])),
"select": new OpenLayers.Style({
externalGraphic: "http://openlayers.org/dev/img/marker-blue.png"
})
})
})
map.addLayers([vectors3]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
selectControl = new OpenLayers.Control.SelectFeature(
[],
{
clickout: true, toggle: false,
multiple: false, hover: false,
toggleKey: "ctrlKey", // ctrl key removes from selection
multipleKey: "shiftKey", // shift key adds to selection
onSelect: onFeatureSelect,
onUnselect: onFeatureUnselect
}
)
map.addControl(selectControl);
selectControl.activate();
map.setCenter(new OpenLayers.LonLat(0, 0), 3);
vectors3.addFeatures(createFeature());
selectControl.setLayer([vectors3]);
};
function createFeature(){
var dot = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(0, 0)
);
return dot;
};
function onFeatureSelect(feature){
selectedFeature = feature;
popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
null,
"<div style='font-size:.8em'>Feature: " + feature.id
/*+"</div><div>
\"http://s1.alt1040.com/files/2011/08/logofirefox-300x289.jpg\" </div> ",*/
+"</div><div>
\"http://1.bp.blogspot.com/_J-zTT8V7dt0/TA6riYzb_OI/AAAAAAAAATo/6QQ8R7JWclM/s1600/ie-8.jpg\"
</div> ",
null, true, onPopupClose);
feature.popup = popup;
map.addPopup(popup);
};
function onFeatureUnselect(feature){
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
};
function onPopupClose(evt) {
selectControl.unselect(selectedFeature);
};
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Weird-popup-behaviour-in-IE-tp6931713p6931736.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list