To add a pop-up, you can rely exclusively on HTML and CSS, but the OpenLayers 3 library bundles a component to help you to display information in a pop-up.
You will find below the reference for this component called ol.Overlay
. Only a light review will be done here because some examples will follow to illustrate.
The object is instantiated with a constructor such as:
var yourOverlay = new ol.Overlay({ element:document.getElementById('yourOverlayElement') })
Because ol.Overlay
inherits from ol.Object
, we only describe here the methods related to the object itself.