Js淡入淡出

来自CloudWiki
跳转至: 导航搜索

<!DOCTYPE html> <html> <head>

   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <title>淡入淡出</title>
   <link rel="stylesheet" href="">
   <style>
       .box{
           width:500px;
           height:400px;
           background:orange;
       }
   </style>
   <script src="js/jquery.min.js"></script>
   <script>
       $(function(){
           $(".in").click(function(){
               $(".box").fadeIn(3000);
           });
           $(".out").click(function(){
               $(".box").fadeOut(3000);
           })
           $(".to").click(function(){
               $(".box").fadeTo("slow",0.5);
           })
           $(".toggle").click(function(){
               $(".box").fadeToggle();
           })
       })
   </script>

</head> <body> <button class="in">淡入</button> <button class="out">淡出</button> <button class="to">到</button> <button class="toggle">切换</button>

您好,欢迎您选择这里

</body> </html>