我有这个:
<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/