javascript - On hover fadeToggle with multiple divs -
so have divs img inside. above img div hidden, appear on hover of img. know how make work, want simpler, more own learning. want work same have, simpler , cleaner jquery/javascript.
$('#img-1').hover(function(){ $('#overlay-1').stop().fadetoggle(400); }); $('#img-2').hover(function(){ $('#overlay-2').stop().fadetoggle(400); });
here in action: jsfiddle
$('.img').hover(function(){ $(this).find('.overlay').stop().fadetoggle(400); });
the $(this) keyword object you're calling hover() on. find() children of thing hovered class .overlay
Comments
Post a Comment