Ver Mensaje Individual
  #10 (permalink)  
Antiguo 02/04/2011, 14:28
Avatar de Naahuel
Naahuel
 
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: Hacer que el background cambie la imagen cada cierto tiempo

Cita:
Iniciado por _cronos2 Ver Mensaje
Muy bueno el script, puedes hacer esto para evitar el do while:
Código Javascript:
Ver original
  1. Array.prototype.noRepetir = function(){
  2.   this.esNuevo = this.esNuevo == null;
  3.   this.copia = this.esNuevo || !this.copia.length ? this.concat() : this.copia;
  4.   return this.copia.splice(Math.floor(Math.random() * this.copia.length), 1);
  5. }
  6. var arr = [2, 'abc', false, [], 'def', {}, true];
  7. for(i = 0; i<14; i++) document.write(arr.noRepetir()+'<br>');
Saludos (:
Excelente, eso mejora el rendimiento considerablemente.
Puse este script en mi blog personal, con una alternativa que varía en orden y no aleatoriamente, por si a alguien le interesa:

[URL]http://nahueljose.com.ar/articles/cambiar-o-rotar-la-imagen-de-fondo-de-un-contenedor-con-jquery/[/URL]
__________________
nahueljose.com.ar