[英]Chrome displaying loading gif differently than Safari and Firefox
I am having trouble with a loading image in chrome, it looks fine in safari and firefox, but in chrome I get the view of two half loading images instead of one whole one. 我在chrome中加载图片时遇到问题,在Safari和Firefox中看起来不错,但是在chrome中,我可以看到两个一半的加载图片,而不是一个完整的图片。 I am not sure how to solve this problem, any help is appreciated.
我不确定如何解决此问题,不胜感激。
THE HTML: HTML:
<div class="execute-actions">
<div class="loading"></div>
</div>
THE CSS: CSS:
.loading {
position: relative;
background: url("../../assets/img/core/loading.gif");
background-position: 912px 0px;
width: 48px;
height: 48px;
}
Part of THE JS that references the loading animation: 引用加载动画的JS的一部分:
$(window).ready(function () {
if ($("html[data-useragent*='MSIE 8']").length) {
if ($("div.loading")) {
setInterval(function () {
$("div.loading").css({"background-position-x": "-=48px" });
}, 35);
}
} else {
if ($("div.loading")) {
setInterval(function () {
$("div.loading").css({"background-position": "-=48px" });
}, 35);
}
}
Check the CSS styles on the .loading div while the animation is running. 动画运行时,检查.loading div上的CSS样式。 You'll probably see that both x and y axis are being overwritten.
您可能会看到x和y轴都被覆盖。 Can't say much more without a fiddle, but probably chrome sets background-position-y to 50%.
没有摆弄就不能说更多,但是chrome可能会将background-position-y设置为50%。 So probably you should also use 'background-position-x' also in chrome :)
所以可能您也应该在chrome中也使用'background-position-x':)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.