jquery effect .shake() firing strangely in different browsers -
my .shake() effect giving me business across multiple browsers. instance, in chrome, if hover quickly, queue buildup problem. if try implementing .stop() before shake effect, element begin downward shake , hang there without animation completing , element out of place. in ie, animation fires more once (even if haven't hovered in , out). , annoyingly, if keep mouse on link, fire animation on , on , over.
i've tried playing around .stop() , different variations of true/false arguments. i've tried using queue:false on each step of animation. tried putting .shake effect times:0 on mouseleave portion of function (with hilarious results). @ loss try next.
my code below, here link menu shake problem.
$(document).ready(function () { $('.shake').hover(function () { $(this).animate({ 'color': '#fc0' }, 150).effect('shake', { times: 1, distance: 12, direction: 'down' }, 50); }, function () { $(this).animate({ 'color': '#8a600f' }, 500); });
my first thought add .stop(true,true) before each .animate(), said you've tried that.
you can test whether element animated , queue new animation if needed:
$('.shake').hover(function() { var $this = $(this); if (!$this.is(":animated")) { $this.animate({ 'color': '#fc0' },150).effect( 'shake', { times:1, distance:12, direction: 'down' }, 50 ); } }, function () { $(this).animate({ 'color': '#8a600f' },500); }); see :animated selector doco more info.
Comments
Post a Comment