X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/46af060a3708c2d213e550a2d7482cdf56a92e9c..86bb9e5a50cd38de813705d99ee63ebd4d15e079:/public/javascripts/menu.js diff --git a/public/javascripts/menu.js b/public/javascripts/menu.js index 9f88f0e0c..5b4c3050e 100644 --- a/public/javascripts/menu.js +++ b/public/javascripts/menu.js @@ -10,6 +10,14 @@ function openMenu(anchor, menu) { }); } +/* + * Close a menu. + */ +function closeMenu(menu) { + clearTimeout(menu.timer); + menu.style.display = "none"; +} + /* * Callback called when the mouse enters a menu anchor. */ @@ -58,7 +66,9 @@ function createMenu(anchorid, menuid, delay) { var anchor = $(anchorid); var menu = $(menuid); + anchor.observe("mouseup", function (event) { closeMenu(menu) }); anchor.observe("mouseover", function (event) { enterMenuAnchor(anchor, anchor, menu, delay) }); anchor.observe("mouseout", function (event) { leaveMenuAnchor(event, anchor, menu) }); + menu.observe("mouseup", function (event) { closeMenu(menu) }); menu.observe("mouseout", function (event) { leaveMenu(event, anchor, menu) }); }