Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/05/2014, 09:05
Avatar de YYs86
YYs86
 
Fecha de Ingreso: abril-2012
Ubicación: Salamanca
Mensajes: 136
Antigüedad: 12 años
Puntos: 14
Respuesta: Optimizar efecto acordeón

Se me ocurre pero no solo con CSS, sino usando también Jquery:

Código PHP:
Ver original
  1. <!doctype html>
  2. <html lang="es">
  3. <head>
  4.     <title>Efecto aumentar</title>
  5.     <style type="text/css">
  6.         body
  7.         {
  8.             margin: 0;
  9.             padding: 0;
  10.         }
  11.         nav
  12.         {
  13.             position: fixed;
  14.             top: 0;
  15.             left: 0;
  16.             width: 100%;
  17.             height: 100px;
  18.         }
  19.         ul.barra
  20.         {
  21.             width: 50%;
  22.             height: 100px;
  23.             margin: 0 auto;
  24.             padding: 0;
  25.         }
  26.         ul.barra > li
  27.         {
  28.             display: inline-block;
  29.             margin: 0;
  30.             width: 25%;
  31.             height: 100%;
  32.             float: left;
  33.             transition: .7s;
  34.             list-style: none;
  35.         }
  36.         ul.barra > li.active
  37.         {
  38.             width: 55%;
  39.         }
  40.         ul.barra > li.notactive
  41.         {
  42.             width: 15%;
  43.         }
  44.     </style>
  45.     <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
  46.    
  47.     <script>
  48.    
  49.     $(document).ready(function() {
  50.    
  51.         $('.barra li').hover(function() {
  52.        
  53.             $('.barra li').each(function() {
  54.            
  55.                 $(this).addClass('notactive');
  56.            
  57.             });
  58.            
  59.             $(this).removeClass('notactive').addClass('active');
  60.        
  61.         }, function() {
  62.        
  63.             $('.barra li').each(function() {
  64.            
  65.                 $(this).removeClass('active').removeClass('notactive');
  66.            
  67.             });
  68.        
  69.         });
  70.    
  71.     });
  72.    
  73.     </script>
  74.    
  75. </head>
  76. <body>
  77.     <nav>
  78.         <ul class="barra">
  79.             <li style="background-color: #23A38F;"></li>
  80.             <li style="background-color: #B7C11E;"></li>
  81.             <li style="background-color: #EFF1C2;"></li>
  82.             <li style="background-color: #F0563D;"></li>
  83.         </ul>
  84.     </nav>
  85. </body>
  86. </html>
__________________
Web developer:

http://xtremgaming.es
http://leaderleague.com