backgroundPositionX 不适用于 Firefox

编程入门 行业动态 更新时间:2024-10-17 05:31:15
本文介绍了backgroundPositionX 不适用于 Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我玩过 youtube 的精灵动画,但有问题.backgroundPositionX 不能在 Firefox 下工作(但可以在 Chrome 和 IE8 上工作)...这是代码:https://jsfiddle/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/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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-21 01:16:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/993791.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   backgroundPositionX   Firefox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!