Ver Mensaje Individual
  #7 (permalink)  
Antiguo 20/09/2010, 10:00
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 4 meses
Puntos: 65
Respuesta: Mostrar <li> por orden en lugar de random

tiene que tener un orden especial?
aca te paso uno que muestra del primero al ultimo

Código HTML:
Ver original
  1. <title>Prueba</title>
  2. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  3. <script type="text/javascript">
  4. $( function(){  
  5.     $("#tips li:eq(0)").show();
  6.     setInterval("mostrar()",1000);
  7. });
  8. mostrar = function(){
  9.     li = $("#tips li:visible").hide();
  10.     liNext = li.next();
  11.     if(liNext.length){
  12.         liNext.show();
  13.     } else {
  14.         $("#tips li:eq(0)").show();
  15.     }
  16. };
  17. #tips, #tips li{
  18.     margin:0;
  19.     padding:0;
  20.     list-style:none;
  21.     }
  22. #tips{
  23.     width:250px;
  24.     font-size:16px;
  25.     line-height:120%;
  26.     }
  27. #tips li{
  28.     padding:20px;
  29.     background:#e1e1e1;
  30.     display:none; /* hide the items at first only */
  31.     }
  32. </head>
  33. <ul id="tips">
  34.     <li>... if you want to become a better coder you need to eat your vegetables?</li>
  35.     <li>... it takes more time to code a web page then to make a pizza?</li>
  36.     <li>... you should validate your code?</li>
  37.     <li>... jQuery is your friend? For real!</li>
  38.     <li>... no matter what some people claim, you can't learn CSS in 3 hours?</li>
  39. </ul>
  40. </body>
  41. </html>