function slide() { if ($(slide_img).attr("src")!="images/1.jpg"){ $(slide_img).fadeOut(200,function() { $(slide_img).attr({src:"images/1.jpg"}); $(slide_img).fadeIn(200); });} }
OR use can use "this" like: function slide() { if ($(this).attr("src")!="images/1.jpg"){ $(this).fadeOut(200,function() { $(this).attr({src:"images/1.jpg"}); $(this).fadeIn(200); });} } On Dec 26, 11:22 pm, Funktastik <crazy.bib...@gmail.com> wrote: > Hi, > > I wrote some lines to make an element fade in & out when HOVER another > text > this is my script: > > $(sw1).hover(function () { > if ($(slide_img).attr("src")!="images/1.jpg"){ > $(slide_img).fadeOut(200,function() { > $(slide_img).attr({src:"images/1.jpg"}); > $(slide_img).fadeIn(200); > } > );} > },function(event){ /* NOTHING HERE */ } > ); > > I want to define a function named "slide" then call it when HOVER like > this: > > $(sw1).hover(slide(),function(event){ /* NOTHING HERE */ } ); > > what should i write ???