/    Sign up×
Community /Pin to ProfileBookmark

A way to edit the behaviour of an event? HELP

Hello… i’ve got a problem…
i will explain the situation first.. so you know what i’m doing.. and maybe have and idea…

I’ve been given a web application with a DHTML menu and a problem.
I did not create the menu, but i need to fix it.

The menus, currently open when the mouse is over the label (onmouseover).
The menu is based on another menu, which originally opened onclick.
When the menu was changed to open onmouseover the functionality of the menu was affected.

What’s happening is that the browser detects the “onmouseover” event even if the window is not focused. So the menus open if you roll the mouse over the label of a blurred browser, and for some reason (i have yet to discover) the menu that opens up is on TOP of all other applications in windows.

Ive tried a whole bunch of things.
the first thing that came to my mind is this

[CODE]
window.onblur=function(){
menuBar.closeAllMenus();
}
[/CODE]

apparantly the onblur event is rarely detected.. so this doesnt work.

Ive tried the “onmouseout” event of the menus, BUT i dont know why this event doesnt work right.
It detects the mouse-out when the mouse moves to another menu, for example a submenu, BUT it doesnt detect the mouse-out when you move the mouse from an open menu to the browser window.

I tried to make an interval like this:

[CODE]
id=setInterval(closeMenus,5000);

function closeMenus(){
menuBar.closeAllMenus();
}
[/CODE]

the interval was reset everytime the “onmouseover” event was detected.
The problem here, is that if the user doesnt move the mouse, the mouse-over is not detected. So that doesnt work.

What im trying to do now… (i cant think of anything else) is to change the behaviour of the onmouseover event so that it isnt triggered when the browser window is not focused.

could anyone PLEASE help me hehehe.. i dont know what else to doooo…

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @Leon945 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...