Ok I have a very basic function which moves the background position of a div to give it a 'sheen' effect and a second one which shifts it back.
If I get the div by its ID that works fine. But when I try to make the function a bit more universal by using 'this' - it breaks.
This works fine:
function runsheen() {
$('#sheen').animate({backgroundPosition: '-400px 0px'},1000);
}
function resetsheen() {
$('#sheen').css({backgroundPosition: '-0px 0px'});
}
But this does nothing
function runsheen() {
$(this).animate({backgroundPosition: '-400px 0px'},1000);}
function resetsheen() {
$(this).css({backgroundPosition: '-0px 0px'});}
Running it with the ID version means a new function for every button - rubbish. If I use 'this' I can reuse the code over and over, right? Can anyone help me make this work?