tags:

views:

26

answers:

1

Code:

//create the animation.
  $('img#header').hover(function(){
  $(this).animate({"top": "-10px" }, "slow");

I am trying to have the hover stop and go back to normal when the user hovers off the image. I got the animation working, just not when I hover off. Any help?

A: 
$('img#header').hover(function()
{
    $(this).animate({"top": "-10px" }, "slow");
}, function()
{
    $(this).animate({"top": "0"}, "slow");
});
Coronatus
+1 - I would also add a `.stop()` before each `.animate()` call, to prevent a queue when hovering in/out.
Nick Craver
It didn't work for me...
kawohi-dev
Sorry but "didn't work" isn't a useful error message. What errors messages are output (in Firefox/Chrome's console)?
Coronatus
Nvm, it was me who got it wrong, but THANKS IT WORKED!
kawohi-dev