Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

only onMouseOver or only onMouseOut at one time?

Status
Not open for further replies.

Wangfeel

Technical User
May 7, 2003
5
CN
I let four pictures have same effects Like this:
<img src=&quot;brjj2.jpg&quot; alt=&quot;&quot; width=&quot;138&quot; height=&quot;91&quot; border=&quot;0&quot; style=&quot;FILTER:alpha(opacity=20)&quot; onMouseOver=high(this) onMouseOut=low(this)>
high(this) and Low(this) function is to let the picture highlight in and fade out. It works well when I try one by one. But when I move the cursor from one picture to another a little faster. The former picture stoped fading. I try to use different function for different picture. But it failed. Seems that the old &quot;this&quot; was replace by new &quot;this&quot;.I am so confused. I really want to solve this, help? Following is my code.


function high(which2){
if (window.lowlighting)//if lowlighting...
clearInterval(lowlighting)
theobject=which2
highlighting=setInterval(&quot;highlightit(theobject)&quot;,50)
}
//lowlighting picture
function low(which2){
if (window.highlighting)//if highlighting...
clearInterval(highlighting)
theobject=which2
lowlighting=setInterval(&quot;lowlightit(theobject)&quot;,50)
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
if(cur2.filters.alpha.opacity==100)
if (window.highlighting)
clearInterval(highlighting)
}
function lowlightit(cur2){
if (cur2.filters.alpha.opacity<20)
if (window.lowlighting)
clearInterval(lowlighting)
if (cur2.filters.alpha.opacity>20)
cur2.filters.alpha.opacity-=5
else if (window.lowlighting)
clearInterval(lowlighting)
}

-<-@ W.H @->-
 
This happens from time to time when you move the mouse faster (generating lot's of mouse events) than the browser can keep up with.

Probably the best bet would be to place some code in the highlight function that forces all the other cells to fade out before highlighting the current one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top