如何用jQuery实现弹出一个层然后过3秒钟后自动变淡然后消失

如题所述

<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8>
<title>recursion</title>
<style type="text/css">
body {
overflow: hidden;
}
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$ (function ()
    {
    $ (':button').click (function ()
    {
    $ ('div').show ().delay (3000).fadeOut ();
    });
    });
</script>
</head>
<body>
<button>alert</button>
<div
style="display: none; width: 1265px; height: 784px; position: absolute; top: 0px; left: 0px; background-color: rgb(45, 45, 45); z-index: 5000; opacity: 0.2; background-position: initial initial; background-repeat: initial initial;"></div>
</body>
</html>

温馨提示:内容为网友见解,仅供参考
无其他回答