How to make fade in/out keep looping
I have this code to fade in a button on hover and fade out . It works on the first hover but it stops and wont do it on a repeat hover. How can I make it continuous?
here's the html:
- <a href="#" class="offerbutton"><span></span></a>
here's the jquery:
- $(function() {
- $(".offerbutton")
- .find("span")
- .hide()
- .end()
- .hover(function() {
- $(this).find("span").stop().fadeIn(2000);
- }, function() {
- $(this).find("span").stop().fadeOut(2000);
- });
- });