diff --git a/examples/popup.html b/examples/popup.html index 3bc9fd7cfa..74c215e656 100644 --- a/examples/popup.html +++ b/examples/popup.html @@ -9,26 +9,47 @@ Popup example @@ -54,10 +75,9 @@
-
@@ -70,7 +90,7 @@

Uses an overlay to create a popup.

- Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, a place for the content, and an element to represent the little arrow at the bottom. To anchor the popup to the map, an ol.Overlay is created with the popup container. A listener is registered for the map's click event to render the popup, and another listener is set as the click handler for the close button to hide the popup. + Click on the map to get a popup. The popup is composed of a few basic elements: a container, a close button, and a place for the content. To anchor the popup to the map, an ol.Overlay is created with the popup container. A listener is registered for the map's click event to render the popup, and another listener is set as the click handler for the close button to hide the popup.

See the popup.js source to see how this is done. diff --git a/examples/popup.js b/examples/popup.js index dfaee5651d..f291751b8b 100644 --- a/examples/popup.js +++ b/examples/popup.js @@ -28,7 +28,7 @@ var map = new ol.Map({ /** * Elements that make up the popup. */ -var container = document.getElementById('popup-container'); +var container = document.getElementById('popup'); var content = document.getElementById('popup-content'); var closer = document.getElementById('popup-closer'); @@ -39,6 +39,7 @@ var closer = document.getElementById('popup-closer'); */ closer.onclick = function() { container.style.display = 'none'; + closer.blur(); return false; }; @@ -61,7 +62,7 @@ map.on('click', function(evt) { coordinate, 'EPSG:3857', 'EPSG:4326')); overlay.setPosition(coordinate); - content.innerHTML = '

The location you clicked was:

' + hdms + + content.innerHTML = '

You clicked here:

' + hdms + ''; container.style.display = 'block';