Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/04/2015, 06:53
Avatar de ceaped
ceaped
 
Fecha de Ingreso: febrero-2004
Mensajes: 2.185
Antigüedad: 20 años, 2 meses
Puntos: 9
Pregunta Acordeón jQuery. Devolver pestaña

Buenos días
Voy a implementar este acordeón:

http://codepen.io/agrayson/pen/aLpKB

¿Cómo hago para cerrar una pestaña cuando este abierta?

Este es el código que me ejecuta el acordeón:

Código Javascript:
Ver original
  1. <script type="text/javascript" charset="utf-8">
  2. $(document).ready(function(){
  3. var animTime = 300,
  4. clickPolice = false;
  5.  
  6. $(document).on('touchstart click', '.acc-btn', function(){
  7. if(!clickPolice){
  8. clickPolice = true;
  9.      
  10. var currIndex = $(this).index('.acc-btn'),
  11. targetHeight = $('.acc-content-inner').eq(currIndex).outerHeight();
  12.    
  13. $('.acc-btn h1').removeClass('selected');
  14. $(this).find('h1').addClass('selected');
  15.      
  16. $('.acc-content').stop().animate({ height: 0 }, animTime);
  17. $('.acc-content').eq(currIndex).stop().animate({ height: targetHeight }, animTime);
  18.  
  19. setTimeout(function(){ clickPolice = false; }, animTime);
  20. }
  21.    
  22. });
  23.  
  24. });
  25. </script>

Gracias por su ayuda
__________________
Diseñador Gráfico publicitario