Swing element animation on hover

ajdinm

New Member
My goal is to swing an item only on hover, by using CSS and some jQuery (and of course should stop on mouse out).Searching the internet I found the code to swing an element when the document is ready (complete jsFiddle). \[code\]$(document).ready(function() { function swing(){ $('.swing').toggleClass('right'); setTimeout(swing, 1000); } swing();});\[/code\]I tried using the .hover() method, but seems to not work.How can I fix this minor problem?
 
Back
Top