I used to do this, but now it does not work for me ...
I have a container div and div inside with a partially transparent image. When the user hovers over the div container, I would like the background on this div to move 0px -56px. I tried this using animation, as I usually do, it doesn't work. Initially, my old script did not work in version 1.6, so I went back to 1.4.2, and it didn't make any difference, so maybe my code is just rubbish ...
$('.trans_bg').css({"background-position":"0 0"});
$('.trans_bg').hover(
function() {
$(this).animate({backgroundPosition: "(0px -56px)"},{duration:300});
},
function(){
$(this).animate({backgroundPosition: "(0px 0px)"},{duration:300});
})
Any ideas?
source
share