Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/01/2014, 19:36
Avatar de hackjose
hackjose
 
Fecha de Ingreso: abril-2010
Ubicación: Edo Mexico
Mensajes: 1.178
Antigüedad: 14 años, 1 mes
Puntos: 131
animate jquery no funciona

Que tal amigos
Mi codigo esta super facilito y no funciona
No funciona la parte de else

Código HTML:
Ver original
  1. <!doctype html>
  2. <html lang="en">
  3.     <meta charset="UTF-8">
  4.     <title>Jose Vega Frontend</title>
  5.     <link rel="stylesheet" href="http://necolas.github.io/normalize.css/2.1.3/normalize.css" />
  6. *
  7. {
  8.     margin: 0;
  9.     padding: 0;
  10. }
  11. body
  12. {
  13.     font-family: arial;
  14.     font-size: 16px;
  15.     font-weight: 900;
  16. }
  17.  
  18.  
  19.  
  20. header
  21. {
  22.     height: 196px;
  23. }
  24. nav
  25. {
  26.     background-color: #333;
  27.     position: fixed;
  28.     text-align: center;
  29.     width: 100%;
  30. }
  31. nav ul
  32. {
  33.     list-style: none;
  34. }
  35. nav ul li
  36. {
  37.     background-color: #333;
  38.     color: #FFF;
  39.     cursor: pointer;
  40.     height: 20px;
  41.     padding: 4px 0;
  42. }
  43. .flecha-abajo
  44. {
  45.     border-top: 10px solid #FFF;
  46.     border-left: 10px solid transparent;
  47.     border-right: 10px solid transparent;
  48.     display: inline-block;
  49.     height: 0;
  50.     width: 0;
  51. }
  52. .flecha-arriba
  53. {
  54.     border-bottom: 10px solid #FFF;
  55.     border-left: 10px solid transparent;
  56.     border-right: 10px solid transparent;
  57.     display: inline-block;
  58.     height: 0;
  59.     width: 0;
  60. }
  61.     <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
  62.     $(function(){
  63.  
  64.         $("#flecha").click(function(){
  65.             if($("#flecha2").hasClass("flecha-arriba"))
  66.             {
  67.                 $(".aparecer").animate({height:0,padding:0,opacity:0},500);
  68.                 $("#hdrbody").animate({height:"56px"},500);
  69.                 $("#flecha2").toggleClass("flecha-arriba flecha-abajo");
  70.             }
  71.             else
  72.             {
  73.                 $(".aparecer").animate({height:"auto",padding:"4px 0",opacity:1},500);
  74.                 $("#hdrbody").animate({height:"196px"},500);
  75.                 $("#flecha2").toggleClass("flecha-arriba flecha-abajo");
  76.             }
  77.         });
  78.     });
  79. </head>
  80.     <header id="hdrbody">
  81.         <nav>
  82.             <ul>
  83.                 <li>Mis Datos</li>
  84.                 <li class="aparecer">Donde Estudie</li>
  85.                 <li class="aparecer">Cursos que he Tomado</li>
  86.                 <li class="aparecer">Experiencia</li>
  87.                 <li class="aparecer">Que Manejo</li>
  88.                 <li class="aparecer">Sobre Mi</li>
  89.                 <li id="flecha"><div id="flecha2" class="flecha-arriba"></div></li>
  90.             </ul>
  91.         </nav>
  92.     </header>
  93. </body>
  94. </html>

Supongo que es el metodo animate pero en verdad no se como solucionar, si no tendre que hacerlo a mano con un setInterval

Espero me puedan ayudar
saludos