1. 程式人生 > >如何用jQuery實現彈出一個層然後過3秒鐘後自動變淡然後消失

如何用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 >