Advertisement
Guest User

next-with-animation

a guest
Oct 13th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.55 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <link href="https://fonts.googleapis.com/css?family=Nunito&display=swap" rel="stylesheet">
  6.     <title>Animaciones</title>
  7.     <style type="text/css">
  8.         *{
  9.             margin: 0;
  10.             padding: 0;
  11.             font-family: 'Nunito', sans-serif;
  12.         }
  13.         body, html{
  14.             width: 100%;
  15.             height: 100%;
  16.         }
  17.         main{
  18.             width: 100%;
  19.             height: 100%;
  20.             display: flex;
  21.             align-items: center;
  22.             justify-content: center;
  23.         }
  24.         @keyframes entrada {
  25.             from {
  26.                 transform: scale(0);
  27.             }
  28.             to {
  29.                 transform: scale(1);
  30.             }
  31.         }
  32.         @keyframes salida {
  33.             from {
  34.                 transform: scale(1);
  35.             }
  36.             to {
  37.                 transform: scale(0);
  38.             }
  39.         }
  40.         .cuadro{
  41.             animation-duration: 0.5s;
  42.             animation-name: entrada;
  43.             display: none;
  44.             padding: 20px;
  45.             border-radius: 10px;
  46.             border: 2px #0a58bf solid;
  47.             box-shadow: 0px 0px 5px #0a58bf, inset 0px 0px 5px #0a58bf;
  48.         }
  49.         #cuadro_1{
  50.             display: block;
  51.         }
  52.         .cuadro h1{
  53.             color: #0a58bf;
  54.         }
  55.         .cuadro p{
  56.             margin: 0 auto;
  57.             text-align: center;
  58.         }
  59.         .cuadro button{
  60.             cursor: pointer;
  61.             transition: 0.2s;
  62.             margin-top: 20px;
  63.             padding: 15px 30px;
  64.             border-radius: 10px;
  65.             font-size: 17px;
  66.             font-weight: bold;
  67.             border: none;
  68.             background: #fff;
  69.             color: #0a58bf;
  70.             box-shadow: inset 0px 0px 0px 2px #0a58bf;
  71.         }
  72.         .cuadro button:hover{
  73.             transition: 0.2s;
  74.             background: #0a58bf;
  75.             color: #fff;
  76.         }
  77.     </style>
  78.     <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  79.     <script>
  80.         $(document).ready(function(){
  81.             function nextItem(){
  82.                 $('button').on('click', function(){
  83.                     let numer = this.id.split("_")[1];
  84.                     $('#cuadro_'+numer).css('animation-name','salida');
  85.                     setTimeout(function() {
  86.                         $('#cuadro_'+numer).css('display','none');
  87.                         numer++;
  88.                         $('#cuadro_'+numer).css('display','block');
  89.                     }, 500);
  90.                 });
  91.             }
  92.             $('button').on('click', nextItem());
  93.         });
  94.     </script>
  95. </head>
  96. <body>
  97.     <main>
  98.         <div class="cuadro" id="cuadro_1">
  99.             <p>
  100.                 <h1>ESTE ES UN TEXTO DE PRUEBA</h1>
  101.             </p>
  102.             <p>
  103.                 <button id="boton_1">Oprimeme :3</button>
  104.             </p>
  105.         </div>
  106.         <div class="cuadro" id="cuadro_2">
  107.             <p>
  108.                 <h1>ESTE ES UN TEXTO DE PRUEBA</h1>
  109.                 <p>
  110.                     Numero 2
  111.                 </p>
  112.             </p>
  113.             <p>
  114.                 <button id="boton_2">Oprimeme :3</button>
  115.             </p>
  116.         </div>
  117.         <div class="cuadro" id="cuadro_3">
  118.             <p>
  119.                 <h1>ESTE ES UN TEXTO DE PRUEBA</h1>
  120.                 <p>
  121.                     Numero 3
  122.                 </p>
  123.             </p>
  124.             <p>
  125.                 <button id="boton_3">Oprimeme :3</button>
  126.             </p>
  127.         </div>
  128.     </main>
  129. </body>
  130. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement