简体   繁体   English

Chrome显示的加载gif与Safari和Firefox不同

[英]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.

相关问题 Firefox处理window.onpopstate的方式与Chrome和Safari不同吗? - Does Firefox handle window.onpopstate differently than Chrome and Safari? Internet Explorer 9显示的按钮与IE10,Firefox和Safari等不同 - Internet Explorer 9 Displaying buttons differently than IE10, Firefox & Safari ect Safari解释日期时间字符串的方式与Chrome不同 - Safari interpreting datetime string differently than chrome Mozilla FireFox悬停的工作方式与Chrome不同 - Mozilla FireFox hover works differently than in Chrome 元素未在FireFox和Opera上显示,但在Chrome和Safari上正在运行 - Element is not displaying on FireFox & Opera, but on Chrome & Safari is working Div在Chrome和Safari中不显示,但在Firefox中显示 - Div not displaying in Chrome and Safari but does in firefox 我的图片显示在Chrome和Firefox中,但没有显示在Safari或iPhone中 - My image is displaying in Chrome & Firefox, but not safari or iPhone HTML JavaScript-Chrome和Safari / Firefox之间的div元素工作方式不同 - HTML JavaScript - div elements working differently between Chrome and Safari/Firefox 在Flexbox中固定的位置在Chrome和Safari / Firefox之间的行为有所不同 - Position fixed in Flexbox behaves differently between chrome and safari / firefox Intl.NumberFormat 在 Safari 中的工作方式与在 chrome 中不同 - Intl.NumberFormat works differently in safari than in chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM