/    Sign up×
Community /Pin to ProfileBookmark

I’m trying to make a menu system.

[CODE]
<script>

function scrolldown(di,height,time){
var x;
var newtime;
var menu;
if(di == 1){ menu = “menu1”; }
newtime = time + 2;

x = 2*(newtime^2) – height;

var y;
y = parseInt(x);
if(height == 0){ x=5; }
if(x < 0)
{
document.getElementById(menu).style.top = x;
setTimeout(“scrolldown(“+di+”,”+height+”,”+newtime+”)”, 10);
}
else
{
document.getElementById(menu).style.top = 0;
}
}

function gone(di,height){
var menu;
if(di == 1){ menu = “menu1″; }
document.getElementById(menu).style.top = height;
}
</script>

<span id=”menu1″ onmouseover=”scrolldown(1,380,0);” onmouseout=”gone(1,-380);”>
Hello how are you doing?
</div>

[/CODE]

My question is, while the menu is coming down (as it does properly with that script) how can I halt the script and make it disappear if it isn’t completely down and the user moves there mouse off the menu. The way it works now they have to have their mouse over it the entire time it drops then move it away for it to work properly.

Thanks
-Joe

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@qbprogerauthorDec 11.2003 — from the lack of responce, maybe i'm going about doing it wrong? I want a menu that comes down and as it comes down it speeds up. The problem as stated before is that if they move their mouse away before it is completely open it doesn't disappear.

can you use something like this:

document.getElementById(di).event.onmouseover

or something like that? I think i vaguely remember seeing something like that.
×

Success!

Help @qbproger 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 5.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...