jquery - 背景图片未在 chrome 中加载

标签 jquery html css

我有这个:

 <style type="text/css">
.blackitout {
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background: #000 url('/images/loading.gif') no-repeat center;
    opacity: 0.7;
    z-index:99;
}
</style>
<script>
function testfunction (){
    $('#mytest').addClass('blackitout');
}
</script>

我有一个 onclick 调用我的测试函数的链接。它将上面的类添加到一个空的 div 中。这给了我一个变暗的页面和一个正在加载的 gif。适用于 Firefox。但不是 Chrome 。在 chrome 中,如果我在空白页面上手动加载图像,然后在我的 css 中添加或删除链接周围的引号并保存。它将开始工作一段时间。也许我只需要一种比空 div 类和添加类(然后在下一页加载时删除)更好的方法。

最佳答案

试试这个

.blackitout {
    position:fixed;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background-color: #000;
    background-image: url('/images/loading.gif') ;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
    z-index:99;
}

关于jquery - 背景图片未在 chrome 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23618635/

相关文章:

javascript - 在部分不可见/事件时隐藏 iFrame

javascript - Rainbow Jquery 插件不工作

html - 关闭 CSS 3d 透视图

javascript - 需要 Sequence .css() For multi div

python - Django Ajax POST 请求 : Internal server error

javascript - Bootstrap 3.0 词缀

javascript - 来自 HTML 输入字段的文本通过 jquery 函数运行?

javascript - jQuery 模糊事件未触发

html - 需要帮助将 div 与 CSS 对齐

javascript - TypeError : o. 元素未定义 - jquery ui