$('#normal').mouseover(function(){ $(this).stop().effect('shake', {distance:3}, 200); }); /** * When you use the combination "hover" and "shake in effects", * they shake continuously on Firefox. * To avoid it, add "animated" class * and check if the element is animating. */ $('#knack').hover(function(){ if(!$(this).hasClass('animated')){ $(this).addClass('animated'); $(this).stop().effect('shake', {distance:3}, 200); } }, function(){ $(this).removeClass('animated'); });
<h2>Shake continuously on Firefox</h2> <div id="normal" class="shake">HOVER TO SHAKE!</div> <h2>Shake once on every browser</h2> <div id="knack" class="shake">HOVER TO SHAKE!</div>
.shake { background:#ccc; text-align:center; width:200px; }