Buildup of Jquery animations on live event handler -
i using "live" technique in jquery add icons on hover using code below , on site: http://vitaminjdesign.com/adrian/ :
$('a').live('mouseover mouseout', function(event) { if (event.type == 'mouseover') { $('<a href="#"><img src="images/facebook.gif" class="facebook" alt="facebook"></a>').appendto(this).fadein(500); $('<a href="#"><img src="images/twitter.gif" class="twitter" alt="twitter"></a>').appendto(this).fadein(500); } else { $('a').find('.facebook,.twitter').fadeout(500); } });
this works perfectly, there buildup of icons loading. typically use .stop() command, isn't working, perhaps because using live event handler? suggestions? also, icons don't seem fading in, fading out.
try .stop(true, true) so:
$('a').live('mouseover mouseout', function(event) { if (event.type == 'mouseover') { $('<a href="#"><img src="images/facebook.gif" class="facebook" alt="facebook"> </a>').appendto(this).fadein(500); $('<a href="#"><img src="images/twitter.gif" class="twitter" alt="twitter"> </a>').appendto(this).fadein(500); } else { $('a').find('.facebook,.twitter').stop(true, true).fadeout(500); } });
Comments
Post a Comment