1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| <script src="../js/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ $('div').click(function(){ let w = $(this).css('width'); let h = $(this).css('height'); $(this).animate({ width: parseInt(w)+20, height: parseInt(h)+20, },'slow') $('h2').animate({marginLeft: "200px"}, 2000, ); $('h3').animate({ marginLeft:"200px", width : "100px" }, 2000); $('h4').animate({marginLeft:"300px"},2000, function(){ $('h4').animate({marginLeft:"0px"},2000) }); $('h4').animate({marginLeft: "200px" },2000) .animate({marginLeft: "0px" },1000) .animate({marginLeft: "100px" },1000) .animate({marginLeft: "0px" },1000); $('#btn').click(function(){ $('h2').stop(); $('h3').stop(); $('h4').stop(); $('h4').clearQueue(); $('h4').finish(); }); $('h3').delay(1000).animate({ marginLeft: "150px", width: "100px" },4000); }) }); </script>
</head> <body>
<div>시작</div>
<h2>내용1</h2> <h3>내용2</h3> <h4>내용3</h4> <input type="button" value="정지" id="btn">
</body>
|