Question

I'm having a bit of an issue getting the return animation to play on the hover out state.

$("#porttab").hover(function(){
    $(this).stop().animate({"top" : "40px"}, {
        duration: 'slow',
        easing: 'easeOutElastic'
    }, function(){
        $(this).stop().animate({"top": "-40px"}, {
            duration: 'slow',
            easing: 'easeOutElastic'
        });
    });
});

I don't know what I'm doing wrong here, but I'm a bit of a jquery noob so please be gentle.

And I'm using the easing plugin, if that makes a difference.

Was it helpful?

Solution

I think there you missed to close the first argument of the hover.. See below

$("#porttab").hover(function() {
    $(this).stop().animate({
        "top": "40px"
    }, {
        duration: 'slow',
        easing: 'easeOutElastic'
    });
}, function() {
    $(this).stop().animate({
        "top": "-40px"
    }, {
        duration: 'slow',
        easing: 'easeOutElastic'
    });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top