From: Tom Hughes Date: Wed, 17 Nov 2010 15:47:59 +0000 (+0000) Subject: Use prototype to capture events so the menus work on IE X-Git-Tag: live~6238^2~31 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/918dd5679f893313688dc2033fb8f46bf8463c0e?hp=9c2de4039c3053c35e76f596faa95557dc237c74 Use prototype to capture events so the menus work on IE --- diff --git a/public/javascripts/menu.js b/public/javascripts/menu.js index 7a0cbf419..d4e8bb65a 100644 --- a/public/javascripts/menu.js +++ b/public/javascripts/menu.js @@ -27,7 +27,7 @@ function enterMenuAnchor(event, anchor, menu, delay) { * Callback called when the mouse leaves a menu anchor. */ function leaveMenuAnchor(event, anchor, menu) { - var to = event.relatedTarget || event.toElement; + var to = event.relatedTarget; if (to != menu && !to.descendantOf(menu)) { menu.style.display = "none"; @@ -40,7 +40,7 @@ function leaveMenuAnchor(event, anchor, menu) { * Callback called when the mouse leaves a menu. */ function leaveMenu(event, anchor, menu) { - var to = event.relatedTarget || event.toElement; + var to = event.relatedTarget; if (to != anchor && !to.descendantOf(menu)) { menu.style.display = "none"; @@ -56,7 +56,7 @@ function createMenu(anchorid, menuid, delay) { var anchor = $(anchorid); var menu = $(menuid); - anchor.onmouseover = function (event) { enterMenuAnchor(anchor, anchor, menu, delay) }; - anchor.onmouseout = function (event) { leaveMenuAnchor(event, anchor, menu) }; - menu.onmouseout = function (event) { leaveMenu(event, anchor, menu) }; + anchor.observe("mouseover", function (event) { enterMenuAnchor(anchor, anchor, menu, delay) }); + anchor.observe("mouseout", function (event) { leaveMenuAnchor(event, anchor, menu) }); + menu.observe("mouseout", function (event) { leaveMenu(event, anchor, menu) }); }