Jquery 动画GIF在IE中停止,但在FF和Chrome中工作
我试图在点击按钮时显示动画GIF,但它在IE(8,9)中被冻结,在IE11、FF和Chrome中工作 有什么解决办法吗 这里是html代码Jquery 动画GIF在IE中停止,但在FF和Chrome中工作,jquery,html,css,asp.net,internet-explorer,Jquery,Html,Css,Asp.net,Internet Explorer,我试图在点击按钮时显示动画GIF,但它在IE(8,9)中被冻结,在IE11、FF和Chrome中工作 有什么解决办法吗 这里是html代码 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <link rel="stylesheet" type="text/css" href="ht
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/start/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<title></title>
<style type="text/css">
.cssbox-progress {
background-image: url('images/3.gif');
background-repeat: no-repeat;
}
.loading
{
width: 50px;
height: 10px;
display: none;
background-color: White;
}
</style>
<script >
function ShowProgress() {
setTimeout(function () {
var loading = $(".loading");
loading.show();
}, 200);
}
function test() {
ShowProgress();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="loading" align="center" style="width: 50px; height: 10px; ">
<div class="cssbox-progress" style="width: 50px; height: 10px;"></div>
</div>
<asp:Button ID="btn" runat="server" Text="Login" onclientclick ="test()" />
</form>
</body>
</html>
.cssbox进程{
背景图像:url('images/3.gif');
背景重复:无重复;
}
.装货
{
宽度:50px;
高度:10px;
显示:无;
背景色:白色;
}
函数ShowProgress(){
setTimeout(函数(){
变量加载=$(“.loading”);
loading.show();
}, 200);
}
功能测试(){
ShowProgress();
}
动画GIF
以下是对评论的回应: 1-您需要显示“正在加载”的动画gif。 2-gif在IE 8/9中未设置动画。 3-你需要在css中更改源代码,因为你正在使用主题 答案是
<style>
.cssbox-progress {
content: url('http://i.stack.imgur.com/dS784.gif');
}
</style>
.cssbox进程{
内容:url('http://i.stack.imgur.com/dS784.gif');
}
及
我没有在IE 8/9上测试它,我使用了一个插件来测试它的外观,但是你应该测试它以确保。我强烈怀疑IE 8和9是否支持动画GIF作为div背景图像。使用tag代替(为什么不呢?)此外,你的代码显示
$(“.loading”)
,而$(“.loading”)
只是一个空div。我想它确实完成了它应该做的事情:)我不确定我是否可以使用图像标记,因为需要在css中设置GIF图像。是的,你可以使用图像标记。正如Jeremy所说,IE8,9上的背景图像不支持动画。我可以在css中设置图像src吗?CSS不用于定义DOM元素属性的值是content:url(“images/3.gif”)
<img class="cssbox-progress" />