动画效果总结

原创 2018-10-31 20:13:26 266
摘要:<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>动画效果总结</title>    <script type="

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>动画效果总结</title>
   <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
   <style type="text/css">
.main{width:100px;height: 100px;margin: 20px 20px;float:left;}
       .fadein,.fadeout,.fadetoggle,.fadeto{width:100px;height:100px;background: blue; }
       .bt1,.bt2,.bt3,.bt4{height:40px;width:100px;margin-top: 10px;}
       div{width:100px;height:100px;background: red;position: absolute;}
   </style>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
       //显示隐藏
/* $('.hide').click(function(){
           $('p').hide(1500)
       })
       $('.show').click(function(){
           $('p').show(1500)
       })*/

       //淡入淡出
/*$('.fadein').hide()
       $('.bt1').click(function(){
           $('.fadein').fadeIn(3000)
       })
       $('.bt2').click(function(){
           $('.fadeout').fadeOut(3000)
       })
       $('.bt3').click(function(){
           $('.fadetoggle').fadeToggle(3000)
       })
       $('.bt4').click(function(){
           $('.fadeto').fadeTo(3000,0.1)
       })*/

       //动画效果
$('#right').click(function(){
           $('.box1').animate({left:'+500px',
opacity:'0.3',
height:'200px',
width:'200px'},3000)
           $('.box1').animate({fontSize:'20px'})
       })
       $('#stop').click(function(){
           $('.box1').stop()
       })

   })


</script>
<!--<p>测试显示隐藏</p>
<button>隐藏</button>
<button>显示</button>-->

<!--<div>
   <div></div>
   <button>淡入</button>
</div>
<div>
   <div></div>
   <button>淡出</button>
</div>
<div>
   <div></div>
   <button>切换</button>
</div>
<div>
   <div></div>
   <button>切换</button>
</div>-->

<button id="right">右移</button>
<button id="stop">停止</button>
<div class="box1">php中文网</div>
</body>
</html>

理解:整体布局时,尺寸比较难把握。

发布手记

热门词条