Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/01/2014, 16:41
Avatar de berkeleyPunk
berkeleyPunk
 
Fecha de Ingreso: febrero-2013
Ubicación: México :C
Mensajes: 565
Antigüedad: 11 años, 2 meses
Puntos: 22
Sonrisa Sólo IE11 hace extraño con animación CSS

Buena tarde.

Tengo un div principal que contiene a su vez otros divs. Cuando se pone el cursor encima sobre el div principal se activa una animación de IDA con ayuda de JS. Y una animación de VUELTA cuando se quita el cursor.

El código que a continuación pondré, funciona perfectamente con Chrome, Firefox y Opera. Pero hace extraños en IE11.

Estos extraños consisten en lo sig. Como decía, el div principal contiene otros divs, por ejemplo A, B y C. Si se pasa el cursor de A a B, o de B a A, o la combinación que se les ocurra, se activa la animación de VUELTA, como si quitáramos el cursor del div principal.

Los divs hijos, todos, están dentro del div principal, así que IE11 no debería ejecutar la animación de VUELTA cuando pasamos de un div hijo a otro hijo, porque todos estos sub-divs están dentro del principal, del cual aún no hemos salido.

El código es un poco largo. Así que para que todo sea más breve, les pongo todo el código de una vez:
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <style type="text/css">
  5.  
  6.  
  7. html, body {width:100%; height:100%;}
  8.  
  9. /*           Animación de IDA         */
  10.  
  11. @-webkit-keyframes animation_1
  12. {
  13.     0%   {-webkit-transform:translateX(0%);}
  14.     20%, 24%, 100%  {-webkit-transform:translateX(66%);}
  15.     22%  {-webkit-transform:translateX(46%);}
  16.     55%  {-webkit-transform:translateX(54%);}
  17. }
  18.  
  19. @-ms-keyframes animation_1
  20. {
  21.     0%   {-ms-transform:translateX(0%);}
  22.     20%, 24%, 100%  {-ms-transform:translateX(66%);}
  23.     22%  {-ms-transform:translateX(46%);}
  24.     55%  {-ms-transform:translateX(54%);}
  25. }
  26.  
  27.  
  28. /*           Animación de VUELTA         */
  29.  
  30. @-webkit-keyframes animation_2
  31. {
  32.     0%   {-webkit-transform:translateX(66%);}
  33.     20%, 24%, 100% {-webkit-transform:translateX(0%);}
  34.     22%  {-webkit-transform:translateX(26%);}
  35.     55%  {-webkit-transform:translateX(16%);}
  36. }
  37.  
  38. @-ms-keyframes animation_2
  39. {
  40.     0%   {-ms-transform:translateX(66%);}
  41.     20%, 24%, 100% {-ms-transform:translateX(0%);}
  42.     22%  {-ms-transform:translateX(26%);}
  43.     55%  {-ms-transform:translateX(16%);}
  44. }
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. .caja_1 {
  53.     position:absolute;
  54.     top:6%;
  55.     left:0%;
  56.     width:16%;
  57.     height:84%;
  58. }
  59. .caja_5 {
  60.     position:absolute;
  61.     top:20%;
  62.     left:-100%;
  63.     width:150%;
  64.     height:20%;
  65.     background-color:rgba(0,51,0,.7);
  66. }
  67. .caja_6 {
  68.     display:block;
  69.     position:relative;
  70.     top:9%;
  71.     margin-right:2%;
  72.     float:right;
  73.     width:30%;
  74.     height:80%;
  75.     background-color:rgba(0,0,0,.5);
  76. }
  77. .caja_7 {
  78.     display:block;
  79.     position:relative;
  80.     top:9%;
  81.     margin-right:2%;
  82.     float:right;
  83.     width:62%;
  84.     height:80%;
  85.     background-color:rgba(0,0,0,.5);
  86. }
  87.  
  88. <script type="text/javascript">
  89.  
  90.     function animar(objeto)
  91.     {
  92.         objeto.addEventListener('mouseover',function()
  93.         {
  94.             objeto.style.WebkitAnimationName = 'animation_1';
  95.             objeto.style.WebkitAnimationDuration = '500ms';
  96.             objeto.style.WebkitAnimationFillMode = 'forwards';
  97.             objeto.style.WebkitAnimationIterationCount = '1';
  98.             objeto.style.WebkitAnimationTimingFunction = 'ease';
  99.  
  100.             objeto.style.msAnimationName = 'animation_1';
  101.             objeto.style.msAnimationDuration = '500ms';
  102.             objeto.style.msAnimationFillMode = 'forwards';
  103.             objeto.style.msAnimationIterationCount = '1';
  104.             objeto.style.msAnimationTimingFunction = 'ease';
  105.  
  106.         },false)
  107.  
  108.  
  109.  
  110.         objeto.addEventListener('mouseout',function()
  111.         {
  112.             objeto.style.webkitAnimationName = 'animation_2';
  113.             objeto.style.webkitAnimationDuration = '500ms';
  114.             objeto.style.webkitAnimationFillMode = 'forwards';
  115.             objeto.style.webkitAnimationIterationCount = '1';
  116.             objeto.style.webkitAnimationTimingFunction = 'ease';
  117.  
  118.             objeto.style.msAnimationName = 'animation_2';
  119.             objeto.style.msAnimationDuration = '500ms';
  120.             objeto.style.msAnimationFillMode = 'forwards';
  121.             objeto.style.msAnimationIterationCount = '1';
  122.             objeto.style.msAnimationTimingFunction = 'ease';
  123.  
  124.         },false)
  125.     }
  126.  
  127.  
  128.  
  129. </head>
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.   <div class="caja_1">
  137.  
  138.     <div class="caja_5" onmouseover="animar(this)">
  139.       <div class="caja_6">
  140.       </div>
  141.      
  142.       <div class="caja_7">
  143.       </div>
  144.     </div>    
  145.  
  146.   </div>
  147.  
  148. </body>
  149. </html>


Saludos cordiales