l-emi l-emi - 1 year ago 82
Javascript Question

How to apply a jquery animation to a single item?

I don't know if I worded this correctly, but I am trying to get an item to shake using jquery when you hover over it. I managed to do this, but it shakes whenever you hover over the whole row. I want it to shake ONLY when you hover over the image.

Here's the HTML:

<div class="top-logo" align="center">
<span class="fa fa-magic fa-5x" aria-hidden="true"></span>

The javascript:

$(this).stop().effect('shake', {distance:3}, 200);
}, function(){

Here's the full code: http://codepen.io/l-emi/pen/QNZevb

I tried using
which works but moves the wand to the left while I want it to be centered.

Thanks for any help!

Answer Source




$('.top-logo span')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download