How to fadeIn & fadeOut a function?
Hi all,
I'm 3 hours stuck on trying to find a code wich allows me to fadeIn and fadeOut in a mouseover/mouseout function with a var in it.
I tried a lot of things adding this piece of code I got into it:
- $ (this).fadeIn(1000);
- $ (this).fadeOut(1000);
This is what I got for now:
- $(function() {
-
- $(".fade2 img")
- // I want this fade in
- .mouseover(function() {
- var src = $(this).attr("src").match(/[^\.]+/) + "_2.gif";
- $(this).attr("src", src);
- })
-
- // I want this fade out
- .mouseout(function() {
- var src = $(this).attr("src").replace("_2", "");
- $(this).attr("src", src);
- });
-
- });
Can anybody help me? Thank you in advanced!