My situation began as follows: I wanted to animate the background image of a div, but it seems like with jquery I cannot get the individual positions of the background images (background-position). So I thought, why not create an object and animate its values, but just put those values in css, but I can’t figure out how to do this yet. Here is what I have tried.
var obj={t:0};
$("#wrapper").animate({
obj:100
},1000,'linear',function(){},function(){
$("#wrapper").css({
'background-position':obj.t+"% 0%"
});
});
Another question I need to ask is that if the picture is really big, I mean about 4000x4000 pixels, would it be better to set it as a background image, change the position of the background or move around the div itself?
source
share