[Users] Mouserover Events
Stefan Schwarzer
stefan.schwarzer at unepgrid.ch
Tue Aug 10 12:58:19 CEST 2010
>> thanks a lot for the tips. Just checked it out, but unfortunately I get a "TypeError: Result of expression 'this.map' [null] is not an object." in "OpenLayers.js:803" on the "sm: ....." line. Any idea what that can mean or what to do about it?
>
> You need to add the SelectFeature control to the map and activate it,
> as the FeatureSelectionModel won't do it for now.
Thanks for that.
I looked around and found this, which works for clicking, but not as mouse-over:
selectControl = new OpenLayers.Control.SelectFeature(vecLayer);
map.addControl(selectControl);
selectControl.activate();
vecLayer.events.on({
featureselected: function(e)
{
createPopup(e.feature);
}
});
function createPopup(feature)
{
var content = "<div style='font-size:.9em; width:270px;'><b>" + feature.attributes.name + "</b><hr />" + "</div>";
popup = new GeoExt.Popup({
title: 'Details',
feature: feature,
width:270,
height:170,
html: content,
collapsible: true
});
popup.on({
close: function()
{
if(OpenLayers.Util.indexOf(vecLayer.selectedFeatures, this.feature) > -1)
{
selectControl.unselect(this.feature);
}
}
});
popup.show();
}
How can I turn this then into a mouse-over popup?
Thanks for any tips!
Stef
More information about the Users
mailing list