From 918dd5679f893313688dc2033fb8f46bf8463c0e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 17 Nov 2010 15:47:59 +0000 Subject: [PATCH] Use prototype to capture events so the menus work on IE --- public/javascripts/menu.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) }); } -- 2.39.5