Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/05/2016, 14:21
Avatar de Rafael
Rafael
Modegráfico
 
Fecha de Ingreso: marzo-2003
Mensajes: 9.028
Antigüedad: 21 años, 1 mes
Puntos: 1826
Respuesta: Sobre parallax y animaciones, unas cuantas dudas de novato

Hum. Acá está el demo de ese tutorial:

http://miguelmanchego.com/samples/20...nimaciones.htm

Si ves el código fuente de la página notarás que necesitas simplemente 3 recursos:

Código HTML:
Ver original
  1. <link href="animate.css" rel="stylesheet" type="text/css" />
  2.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  3.     <script src="waypoints.min.js"></script>

El animate y el waypoints están alojados en tu sitio y el Jquery jalado desde googleapis.

Y el código necesario para que funcione en lo que tu gustas. Son dos partes, el JavaScript que le indica al waypoints y los estilos a utilizar:

Código HTML:
Ver original
  1. <script type="text/javascript">
  2.     jQuery(function($) {
  3.         $('h2').waypoint(function() {
  4.             $(this).toggleClass( 'bounceIn animated' );
  5.         },
  6.         {
  7.             offset: '70%',
  8.             triggerOnce: true
  9.         });
  10.        
  11.         $('li').waypoint(function() {
  12.             $(this).toggleClass( 'fadeInLeft animated' );
  13.         },
  14.         {
  15.             offset: '70%',
  16.             triggerOnce: true
  17.         });        
  18.        
  19.         $('img').waypoint(function() {
  20.             $(this).toggleClass( 'rotateIn animated' );
  21.         },
  22.         {
  23.             offset: '70%',
  24.             triggerOnce: true
  25.         });        
  26.     });
  27.     </script>
  28.     <style>
  29.         body {
  30.             font-family: Arial, Helvetica, sans-serif;
  31.         }
  32.         .container {
  33.             width: 320px;
  34.             margin: auto;
  35.             font-size: 14px;
  36.             color:#333;            
  37.         }
  38.         .container p, .container li{
  39.             line-height: 24px;
  40.         }
  41.         .container li {
  42.             padding-bottom: 10px;
  43.             opacity: 0;
  44.         }
  45.         .container h2 {
  46.             margin-top: 25px;
  47.             opacity: 0;
  48.         }
  49.         h1 { font-size: 34px; }
  50.         h2 { font-size: 28px; }
  51.         img { opacity:0; }
  52.     </style>

Eso está resumido en estas instrucciones:

Código HTML:
Ver original
  1. jQuery(function($) {
  2. $('.elemento_deseo_animar').waypoint(function() {
  3. $(this).toggleClass( 'bounceIn animated' );
  4. },
  5. {
  6. offset: '70%',
  7. triggerOnce: true
  8. });
  9.  
  10. });

Pero aparte de eso debes dejar otros archivos como las licencias de animate y waypoints en tu sitio.

Última edición por Rafael; 26/05/2016 a las 09:34