【发布时间】:2013-10-10 23:16:04
【问题描述】:
我在 chrome 中加载图像时遇到问题,它在 safari 和 firefox 中看起来不错,但在 chrome 中,我看到的是两个半加载图像而不是一个完整的图像。我不知道如何解决这个问题,任何帮助表示赞赏。
HTML:
<div class="execute-actions">
<div class="loading"></div>
</div>
CSS:
.loading {
position: relative;
background: url("../../assets/img/core/loading.gif");
background-position: 912px 0px;
width: 48px;
height: 48px;
}
引用加载动画的部分 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);
}
}
【问题讨论】:
-
你能发个小提琴吗?
-
background-position": "-=48px" 的预期行为是什么?在第一个中,如果您正在为一个轴设置动画。在第二个中,您正在为 x 轴设置动画,而 y 轴应该是 @987654324 @而不是
0
标签: javascript jquery html css loading