Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

backgroundPositionX not working on Firefox

I have play with youtube's sprite animation but there is a problem. backgroundPositionX won't work under Firefox (but works on Chrome and IE8)... This is the code: https://jsfiddle.net/74RZb/

Extra info: the problem is that under firefox It doesn't change the background position (won't play the animation)... there are no errors, just doesn't change the background position.

like image 610
T1000 Avatar asked Dec 19 '12 08:12

T1000


3 Answers

Firefox doesn't support backgroundPositionX, but it does support background position

So we can do something like this:

psy.style.backgroundPosition = x+'px 0';

This sets the background position, X first, then Y.

Working example here

like image 51
Andy Avatar answered Oct 16 '22 02:10

Andy


This works in IE, FF and chrome:

background-position: 0 center;

like image 3
technocrusaders.com Avatar answered Oct 16 '22 00:10

technocrusaders.com


This worked for me. NX is number of pixels in axis X and NY in axis Y.

background-position: calc(NXpx) NYpx;
like image 2
Leonardo Cardoso Avatar answered Oct 16 '22 01:10

Leonardo Cardoso