jquery动画篇1-3, #a1设置display: none !important,然后再 $("#a1").css('display', 'block !important'); $("#a1").show(3000); }); 为什么动画不能显示
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<style>
.left div,
.right div {
width: 500px;
height: 50px;
padding: 5px;
margin: 5px;
float: left;
border: 1px solid #ccc;
}
.left div {
background: #bbffaa;
}
.right div {
background: yellow;
}
#a1{display:none !important;}
</style>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
<h2>hide-show</h2>
<div class="left">
<div id="a1">hide-show</div>
<button>直接hide-show动画</button>
<script type="text/javascript">
//点击button
//执行3秒隐藏
//执行3秒显示
$("button").click(function() {
$("#a1").css('display', 'block !important');
$("#a1").show(3000);
});
</script>
</body>
</html>