jQuery on hover image change opacity/fadeout and text fade in -


i complete novice when comes jquery , know there lot of questions on site similar mine couldn't find 1 close enough wanted.

what when mouse hovers on image, image reduce in opacity (or fadeout completely) , text fade in on top of image was. text link position on same page (i'm sure can manage though).

if put in jsfiddle me appreciated not capable enough yet of being able modify jquery existing examples need.

thanks!

try this, may you:

html:

<img class="image" src="" alt="testimage"></img><a id="link">this link content</a> 

css:

 #link {     display: none;  } 

script:

$(".image").hover(function(e) {       e.preventdefault();       $(this).fadeout('slow', function(e) {           $('#link').fadein('slow');       }); });   $("#link").mouseout(function(e) {       e.preventdefault();       $(this).fadeout('slow', function(e) {           $(".image").fadein('slow');       }); });  $( document ).ready(function() {     $(".image")[0].hover();  }); 

fiddle

updated script:

$(".image").hover(function(e) {       e.preventdefault();       $(this).stop().fadeout('slow', function(e) {           $('#link').stop().fadein('slow');       }); });  $("#link, .image").mouseout(function(e) {       e.preventdefault();       if($(this).is("img"))       {           $(".image").stop().fadeout('slow', function(e) {               $('#link').stop().fadeout('slow', function(e) {                   $(".image").stop().fadein('slow');               });           });       }       else       {           $('#link').stop().fadeout('slow', function(e) {               $(".image").stop().fadein('slow');           });       } });  $( document ).ready(function() {     $(".image")[0].hover();  }); 

updated fiddle


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -