Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16448

Re: Persistent onmouseout/hover

From joe <mt@invalid.com>
Newsgroups comp.lang.javascript
Subject Re: Persistent onmouseout/hover
Message-ID <eea378lntfb01lmc86blgc7r3c47mg46re@4ax.com> (permalink)
References <fno278h63p6td5tdotujtdujpehmri0g11@4ax.com> <lbd8k9-ci3.ln1@luuk.invalid.lan>
Date 2012-10-07 19:15 +0300
Organization Elisa Customer

Show all headers | View raw


Here's  my test sample. The html below display's some text in a red box. When
mouse move over the box a blue line is displayed around the red box.
When mouse exit's the box the blue line disappears. 

If I try to set a time for removal of the blue line I get nothing: the blue line
stays there.


<html><head>
<script type="text/javascript">
function timeout_trigger(test) {
test.style.border = "";
}
    
function OnMouseIn (elem) {
elem.style.border = "2px solid blue";
}

function OnMouseOut (elem) {
//setTimeout('timeout_trigger(elem)', 500);   //this does not work
timeout_trigger(elem);                        //this works
}
</script></head>
<body>
<div style="background-color:red; width:200px" onmouseover="OnMouseIn(this)"
onmouseout="OnMouseOut(this)">
Move your mouse pointer into and out of this element!
</div></body></html>


Luuk <luuk@invalid.lan> wrote:

>On 07-10-2012 13:25, joe wrote:
>> I have a sidebarmenu vertical menu. When mouse is over a selection the selection
>> changes color. When mouse leaves the selection the color changes back to default
>> immeadiately.
>>
>> I'd like the selecttion color to stay a bit longer on the screen when mouse moves
>> out (ie onmouseleave). How do I do that?
>>
>
>something like this (sorry for the linenumers ;):
>   1 <html>
>   2 <head>
>   3 <title>onmouseout</title>
>   4 <script type="text/javascript" >
>   5 function one(t) {
>   6 t.style.color = 'red';
>   7 }
>   8 function two(t) {
>   9 setInterval(function(){myTimer(t)},3000);
>  10 }
>  11 function myTimer(t) {
>  12 t.style.color = 'black';
>  13 }
>  14 </script>
>  15 </head>
>  16 <body>
>  17 <a href="" onmousemove="one(this);" 
>onmouseout="two(this);">testlink</a><br>
>  18 </body>
>  19 </html>

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Persistent onmouseout/hover joe <mt@invalid.com> - 2012-10-07 14:25 +0300
  Re: Persistent onmouseout/hover Luuk <luuk@invalid.lan> - 2012-10-07 15:40 +0200
    Re: Persistent onmouseout/hover joe <mt@invalid.com> - 2012-10-07 19:15 +0300
      Re: Persistent onmouseout/hover Luuk <luuk@invalid.lan> - 2012-10-07 19:00 +0200
  Re: Persistent onmouseout/hover Danny <dann90038@gmail.com> - 2012-10-07 12:00 -0700

csiph-web