I made a script that fades out a button when the mouse goes over it and fades in on mouse out. It works fine on the ‘mouseover’ event, but it fails on the ‘mouseout’ any ideas?
P.S. I not using jquery because I am trying to learn this for educational purposes.
Go here to see the code: http://jsfiddle.net/assuredlonewolf/t2sYX/
Feel free to edit it!
You’ve got two issues:
< 1.1to determine whether the element should become visible or not, while thefadecount start at 1.1. Clearly, 1.1 is never lower than 1.1.Updated code, feel free to ask help if you’re having trouble implementing it:
Additional tips:
document.getElementById(elem)in a variable, outside the interval function (but insidefunction fade, for performace reasons. A varibale look-up is less expensive than a function call.