jQuery停止动画学习总结

Original 2018-11-10 18:24:24 219
abstract:<!DOCTYPE html> <html> <head>     <meta charset="utf-8">     <script src="前端课件/jQuery/jquery-3.3.1.min.
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script src="前端课件/jQuery/jquery-3.3.1.min.js"></script>
    <style type="text/css">
       .div_1{width: 100px;height: 100px;background: red;margin-top: 30px;position: absolute;}
    </style>
</head>
<body>
    <script>
      $(document).ready(function(){
          $('#bt_1').click(function(){
             $('.div_1').animate({left:'200px'},2000)
             $('.div_1').animate({top:'200px'},2000)
             $('.div_1').animate({left:'8px',opacity:'0.5'},2000)
             $('.div_1').animate({top:'8px',opacity:'0.5'},2000)            
        })
        $('#bt_2').click(function(){
          $('.div_1').stop(true)        
        })
      })
    </script>
    <button id="bt_1">开始</button>
    <button id="bt_2">停止</button>
    <div class="div_1"></div>
</body>
</html>

通过测试stop()的确如果没有放true值只能停止第一个动画,后续动画会继续执行,放了true值后,就可以控制整个动画效果的停止位置。

Correcting teacher:灭绝师太Correction time:2018-11-11 09:22:37
Teacher's summary:练习的比较全面,继续保持,必要的时候,要带上笔记和备注

Release Notes

Popular Entries