Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Please point me to examples of combining OpenLayers and any external tooltip libraries like this. I try to use native OL tools for building tooltips here, but they not flexible and customizable. Thanks.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

This might not be the best way to do it, but it's one way. You can improve on it.

enter image description here

DEMO LINK

The key here is to move the wrapper/trigger around onFeatureHighlighted event.

var handler_featurehighlighted = function (e) {

    var tt_trigger = tooltipApi.getTrigger();
    tt_trigger.css({ 'left': mouseEvent.clientX + 'px', 'top': mouseEvent.clientY + 'px' });

    $(".tooltip").html("<strong>Feature Name: " + e.feature.attributes.name + "</strong>");

    tooltipApi.show();

};
var handler_featureunhighlighted = function (e) {
    tooltipApi.hide();
};
var highlightControl = new OpenLayers.Control.SelectFeature(myToolTipLayer, {
    hover: true,
    highlightOnly: true,
    renderIntent: "temporary",
    eventListeners: {
        featurehighlighted: handler_featurehighlighted,
        featureunhighlighted: handler_featureunhighlighted
    }
});

map.addControl(highlightControl);

highlightControl.activate();
share|improve this answer

OpenGeo has a workshop on Introduction to Openlayes in which a section about Integration with Other Frameworks was introduced here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.