jq 显示/提示一秒就隐藏;
Html代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
</head>
<style>
#addBox {
display: none;
position: fixed;
top: 50%;
left: 50%;
width: 100px;
margin-left: -50px;
margin-top: -17px;
text-align: center;
background: rgba(0, 0, 0, 0.5);
line-height: 35px;
color: #fff;
height: 35px;
border-radius: 5px;
z-index: 9999999999;
}
#addBox p {
line-height: 35px;
padding: 0;
margin: 0;
}
</style>
<body>
<div id="addBox">
<p>一秒</p>
</div>
<button>显示一秒</button>
</body>
<script>
$(function() {
$(document).on("click", "button", function() {
$("#addBox").fadeIn(200);
setTimeout(function() {
$("#addBox").fadeOut(100)
}, 1000)
})
})
</script>
</html>
注意:记得引用jquery文件

浙公网安备 33010602011771号