:animated





css/style.css
  • * {
  •  margin: 0;
  •  padding: 0;
  • }
  •  
  • .a {
  •  height: 100px;
  •  width: 100px;
  •  margin: 25px;
  •  background-color: #3BA9DE;
  • }
  •  
  • .b {
  •  height: 100px;
  •  width: 100px;
  •  margin: 25px;
  •  background-color: #852E76;
  • }
  •  
  • #button {
  •  height: 100px;
  •  width: 100px;
  •  margin: 25px;
  •  cursor: pointer;
  •  border-radius: 5px;
  •  background-color: #E2E2E2;
  •  text-align: center;
  •  line-height: 100px;
  •  font-size: 26px;
  •  color: #852E76;
  •  font-weight: bold;
  • }
  • * {
  •  margin: 0;
  •  padding: 0;
  • }
  •  
  • .a {
  •  height: 100px;
  •  width: 100px;
  •  margin: 25px;
  •  background-color: #3BA9DE;
  • }
  •  
  • .b {
  •  height: 100px;
  •  width: 100px;
  •  margin: 25px;
  •  background-color: #852E76;
  • }
  •  
  • #button {
  •  height: 100px;
  •  width: 100px;
  •  margin: 25px;
  •  cursor: pointer;
  •  border-radius: 5px;
  •  background-color: #E2E2E2;
  •  text-align: center;
  •  line-height: 100px;
  •  font-size: 26px;
  •  color: #852E76;
  •  font-weight: bold;
  • }


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div id="d0" class="a"></div>
  •  <div id="d1" class="a"></div>
  •  <div class="a"></div>
  •  <div id="button">OK</div>
  •  <script>
  •   function funAnimate0() {
  •    $('#d0').animate({'width': '600px' }, 3000);
  •    $('#d0').animate({'width': '100px' }, 3000);
  •   }
  •   function funAnimate1() {
  •    $('#d1').animate({'width': '400px' }, 3000);
  •    $('#d1').animate({'width': '100px' }, 3000);
  •   }
  •   $(document).ready(function() {
  •    setInterval('funAnimate0()', 0);
  •    setInterval('funAnimate1()', 0);
  •    $('#button').click(function() {
  •     $('div:animated').toggleClass('b');
  •    });
  •   });
  •  </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  •  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div id="d0" class="a"></div>
  •  <div id="d1" class="a"></div>
  •  <div class="a"></div>
  •  <div id="button">OK</div>
  •  <script>
  •   function funAnimate0() {
  •    $('#d0').animate({'width': '600px' }, 3000);
  •    $('#d0').animate({'width': '100px' }, 3000);
  •   }
  •   function funAnimate1() {
  •    $('#d1').animate({'width': '400px' }, 3000);
  •    $('#d1').animate({'width': '100px' }, 3000);
  •   }
  •   $(document).ready(function() {
  •    setInterval('funAnimate0()', 0);
  •    setInterval('funAnimate1()', 0);
  •    $('#button').click(function() {
  •     $('div:animated').toggleClass('b');
  •    });
  •   });
  •  </script>
  • </body>
  • </html>