怎样把在js里面将元素缓慢显示

JavaScript011

怎样把在js里面将元素缓慢显示,第1张

你好,你可以  引用  js   里 jQuery 库.

引用了 百度的 jquery.min.js 。如下

<!DOCTYPE html>

<html>

<head>

<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">

</script>

<script>

$(document).ready(function(){

  $("button").click(function(){

 

    $("#div3").fadeIn(6000)

  })

})

</script>

</head>

<body>

<button>Click to fade in boxes</button>

<br><br>

<div id="div3" style="width:80pxheight:80pxdisplay:nonebackground-color:blue"></div>

</body>

</html>       

//html

<div id="demo" style="width:300px height:300px background-color:#d2d2d2 display:none "></div>

//js

<script src="js/jquery-1.7.2.min.js"></script>    //引用Jquery 

<script type="text/javascript">

   $('#demo').fadeIn(2000) //淡入

   $('#demo').fadeOut(2000) //淡出

  </script>