I am trying to change the background image of a div to hover using jQuery. This is what I came to, however, it does not work:
HTML
<div class="logo"></div>
CSS
.logo { width: 300px; height: 100px; background: url('http://placehold.it/300x100/ffffff/000000.png&text=first') no-repeat center top; }
Js
$('.logo').hover( function(){ $(this).animate({backgroundImage: 'http://placehold.it/300x100/ffffff/000000.png&text=second'},'fast'); }, function(){ $(this).animate({backgroundImage: 'http://placehold.it/300x100/ffffff/000000.png&text=first'},'fast'); });
jsfiddle here: http://jsfiddle.net/26j6P/1/
What am I doing wrong? If I animate the background color, it works fine ...
source share