1
我試圖在按鈕單擊上顯示動畫GIF,但它在IE(8,9)中凍結,適用於IE11,FF和Chrome。動畫GIF在IE中停止,但在FF和Chrome中工作
是否有任何解決方法。
這裏是html代碼;
<!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>
動畫GIF
我強烈懷疑IE 8和9支持動畫GIF作爲div背景圖片。使用
標記代替(爲什麼你不?)此外,你的代碼顯示'$(「。loading」)','$(「。loading」)'只是一個空的div。我認爲它確實是它應該做的:) –
2015-03-02 10:08:15
我不確定如果我可以使用圖像標記作爲GIF圖像需要在CSS中設置。 – user1263981 2015-03-02 10:11:44
是的,你可以使用圖像標籤。這是Jeremy所說的問題,IE8,9上的背景圖像不支持動畫。 – Aristos 2015-03-02 10:15:07