diff options
Diffstat (limited to 'static/main_map.js')
-rw-r--r-- | static/main_map.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/static/main_map.js b/static/main_map.js index 62a9f0d..5305495 100644 --- a/static/main_map.js +++ b/static/main_map.js @@ -64,6 +64,8 @@ function showPop(feature) { feature.popup.toggle(); } currentPopup = feature.popup; + /* hide on click on the cloud */ + currentPopup.groupDiv.onclick = hidePopUp; } /* check checked categories */ @@ -246,13 +248,21 @@ function putMarker(layer, mark) { document.body.style.cursor='auto'; OpenLayers.Event.stop(evt); }; - marker.events.register('mousedown', feature, markerClick); + marker.events.register('click', feature, markerClick); marker.events.register('mouseover', feature, markerOver); marker.events.register('mouseout', feature, markerOut); layer.addMarker(marker); return feature; } +var hidePopUp = function (evt) { + if (clicked) { + currentPopup.hide(); + clicked = false; + hide('detail'); + } +} + /* update current detail panel with an AJAX request */ function updateDetail(pk){ var uri = "/chimere/getDetail/" + pk; @@ -332,6 +342,9 @@ function init(){ permalink.div.childNodes[0].textContent = permalink_label; } map.addLayers([layerMapnik, cyclemap]); + + map.events.register('click', map, hidePopUp); + /* if from a permalink */ if (p_zoom) { var p_centerLonLat = new OpenLayers.LonLat(p_lon, p_lat); |