backgroundPositionX 不适用于 Firefox [英] backgroundPositionX not working on Firefox

查看:42
本文介绍了backgroundPositionX 不适用于 Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我玩过 youtube 的精灵动画,但有问题.backgroundPositionX 不能在 Firefox 下工作(但可以在 Chrome 和 IE8 上工作)...这是代码:https://jsfiddle.net/74RZb/

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/

额外信息:问题是在firefox下它不会改变背景位置(不会播放动画)......没有错误,只是不会改变背景位置.

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.

推荐答案

Firefox 不支持 backgroundPositionX,但支持 背景位置

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

所以我们可以这样做:

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

这会设置背景位置,先是 X,然后是 Y.

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

工作示例这里

这篇关于backgroundPositionX 不适用于 Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆