jQuery实现点击弹出层3秒后自动消失
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jQuery实现点击弹出层3秒后自动消失</title>
</head>
<body>
<a id="dianji">点击</a>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<style type="text/css">
#dianji {text-align: center; margin-top: 50px; font-size: 30px; color: #000; display: block;}
#disappare{border-radius: 10px; background: #000000d4; font-size: 20px; width: 300px; padding: 20px 0; position: fixed; top: 50%; left: 50%; margin: -125px 0 0 -150px; text-align: center; color: white;}
</style>
<div id="disappare" style="display:none;">
<p>复制成功<br>
到微信搜索添加好友领取</p>
</div>
<script type="text/javascript">
$(function(){
$("#dianji").click(function(){
$("#disappare").show().delay(2000).hide(300);
});
})
</script>
</body>
</html>版权保护: 转载请保留链接: https://cgy.isi8.cn/js/200.html
- 上一篇:js输出明天的时间
- 下一篇:随机输出数组,另一数组对应下标输出元素-微信
