Foros del Web » Programando para Internet » Javascript »

rotar 2 imagenes con lightbox

Estas en el tema de rotar 2 imagenes con lightbox en el foro de Javascript en Foros del Web. Buenos días foreros. Tengo una pregunta, tengo una página que muestra algunas imágenes, y quisiera que cada imagen cambie sola cada cierto tiempo, digamos unos ...
  #1 (permalink)  
Antiguo 10/12/2008, 09:08
Avatar de gVenom  
Fecha de Ingreso: julio-2008
Ubicación: Costa Rica
Mensajes: 1.458
Antigüedad: 15 años, 9 meses
Puntos: 53
Exclamación rotar 2 imagenes con lightbox

Buenos días foreros.

Tengo una pregunta, tengo una página que muestra algunas imágenes, y quisiera que cada imagen cambie sola cada cierto tiempo, digamos unos 5 seg. Para cada imagen hay una distinta, o sea, son 4 imágenes y quiero que cada una rote con una sola imagen para cada una, una especifica, no random. De esa manera, cuando ven la primera imagen, a los 4 segundos se cambia y ven otra, y a los 4 segundos se cambia y ven de nuevo la primera, y así para cada una. Las imágenes tienen lightbox, pongo un segmento de el código:
Código HTML:
<a href="Pictures/furaha/Nairobi Slums.jpg" rel="lightbox" title="Nairobi Slums"><img src="Pictures/furaha/Nairobi-Slums.jpg" alt="Click to Zoom" width="335" height="400" border="0" class="img_grande" /></a> 
__________________
"Al que venciere y guardare mis obras hasta el fin, yo le daré autoridad sobre las naciones."
Apocalipsis 2: 26
Servicios para Pymes http://dst.co.cr
  #2 (permalink)  
Antiguo 10/12/2008, 09:27
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: rotar 2 imagenes con lightbox

Fijate si te sirve algo así:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Documento sin t&iacute;tulo</title>
<
script src="lb/lightbox.js"></script>
<link href="lightbox.css" rel="stylesheet" type="text/css" />
<script>
addLoadEvent(function(){
var idis=['uno','dos'];
var i=0;
window.intervalo=setInterval(function(){showLightbox(document.getElementById(idis[i%(idis.length)]));i++},1000);
var oldClose=hideLightbox;
hideLightbox=function(){
    oldClose();
    clearInterval(window.intervalo);
}

});
</script> 
</head>

<body>
<a id="uno" href="img2/2.jpg" rel="lightbox"><img src="img/2.jpg" width="50" height="50" border="0" /></a><br />
<a id="dos" href="img2/1.jpg" rel="lightbox"><img src="img/1.jpg" width="50" height="50" border="0" /></a>

</body>
</html> 
  #3 (permalink)  
Antiguo 10/12/2008, 09:37
Avatar de gVenom  
Fecha de Ingreso: julio-2008
Ubicación: Costa Rica
Mensajes: 1.458
Antigüedad: 15 años, 9 meses
Puntos: 53
Respuesta: rotar 2 imagenes con lightbox

Hola Panino5001.

Pregunta, puse tu código pero me enseña las dos imágenes al mismo tiempo, una al lado de la otra, se supone que no debería pasar cierto? Me falta algo por ahi. aqui esta mi código:

Header:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
title>Crush INC Furaha Community Center</title>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
meta name="author" content="gVenom" />
<
script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/styles.css" type="text/css" />
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script>
addLoadEvent(function(){
var idis=['uno','dos'];
var i=0;
window.intervalo=setInterval(function(){showLightbox(document.getElementById(idis[i%(idis.length)]));i++},1000);
var oldClose=hideLightbox;
hideLightbox=function(){
    oldClose();
    clearInterval(window.intervalo);
}

});
</script>
</head> 
omito algunas cosas que no van al caso como el body.

este es mi css:
Código HTML:
@charset "iso-8859-1";
/* CSS Document */
.h1{ /*Titulos blancos grandes subrayados*/
	color:#FFFFFF;
	font-family:Tahoma;
	font-size:16px;
	text-align:center;
	font-weight:bold;
	text-decoration:underline;
}
.h2{ /*Titulos blancos grandes*/
	color:#FFFFFF;
	font-family:Tahoma;
	font-size:15px;
	text-align:center;
	font-weight:bold;
}
.h4{ /*titulos amarillos*/
	color:#FFFF00;
	font-family:Tahoma;
	font-size:14px;
	font-weight:bold;
}
.style1{/*Titulo grande amarillo subrayado*/
	color:#FFC000;
	font-family:Tahoma;
	text-align:center;
	font-weight:bold;
	text-decoration:underline;
	font-size: 16px;
		}
.style2{ /*texto normal*/
	color:#FFFFFF;
	font-family:Tahoma;
	font-size:12px;
	text-align:justify;
	padding: 2px 2px 5px 5px;
}
#divtitulo1{
	text-align:center;
}
#divtitulo2left{
	text-align:left;
}
#scroll { 
	width:100%; 
	height:640px; 
	background-color:#000000; 
	overflow:auto; 
} 
.imgs_chicas{background-color: #666666;float:left;margin-left:4px; margin-top:inherit}
.img_grande{background-color: #666666; margin:8px; float:left}
y por último el cuerpo donde estan las imágenes:
Código PHP:
<?php    include ("header.php");?>
  <tr>
    <td colspan="28" style="background:URL(images/about_52.jpg)" width="850" ><div id="scroll" > <br />
        <div id="divtitulo1" class="style1">Furaha Community Center</div>
        <a id="uno" href="Pictures/furaha/Nairobi Slums.jpg" rel="lightbox" title="Nairobi Slums"><img src="Pictures/furaha/Nairobi-Slums.jpg" alt="Click to Zoom" width="335" height="400" border="0" class="img_grande" /></a>
        <a id="dos" href="Pictures/furaha/Unimaginable living conditions.jpg" rel="lightbox" title="Unimaginable living conditions"><img src="Pictures/furaha/Unimaginable-living-conditions.jpg" alt="Click to Zoom" width="335" height="400" border="0" class="img_grande" /></a>
        <blockquote>
          <p class="style2">Is in the Huruma slums outside of the metropolis of Nairobi, Kenya. The center provides care and education for the children of Huruma as well as one daily meal with the new feeding program to help them through their school days. Nearly half of these kids are HIV+, and are living with a guardian because their parents have already died. Furaha provides clinical health care for them and for their mothers or guardians who are living with AIDs. CRUSH supports microfinance loans to help these kids get the food, clothes and medical attention they need in an area none of us would ever have our children even visit, let alone grow up. </p>
        </blockquote>
        <p><a href="Pictures/furaha/Meal provided by Furaha.jpg" rel="lightbox" title="Meal provided by Furaha"><img src="Pictures/furaha/Meal-provided-by-Furaha.jpg" alt="Click to Zoom"  width="150" height="138" border="0" class="imgs_chicas" /></a>
            <a href="Pictures/furaha/school kids eating.jpg" rel="lightbox" title="Kids eating"><img src="Pictures/furaha/school-kids-eating.jpg" alt="Click to Zoom" name="prueba2" width="150" height="138" border="0" class="imgs_chicas" /></a> 
          <a href="Pictures/furaha/Furaha kids in uniforms.jpg" rel="lightbox" title="Furaha kids in uniforms"><img src="Pictures/furaha/Furaha-kids-in-uniforms.jpg" alt="Click to Zoom"  width="150" height="138" border="0" class="imgs_chicas" /></a></p>
               </div></td> </tr>
  <?php    include ("footer.php");?>
__________________
"Al que venciere y guardare mis obras hasta el fin, yo le daré autoridad sobre las naciones."
Apocalipsis 2: 26
Servicios para Pymes http://dst.co.cr
  #4 (permalink)  
Antiguo 10/12/2008, 09:41
Avatar de Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: rotar 2 imagenes con lightbox

Ah, estás usando la versión 2 de lightbox. Lo que yo te puse es para la versión 1 (sin scriptaculous). Quizá sea por eso. Te toca entonces estudiar esa versión y ver cómo adaptarla.
  #5 (permalink)  
Antiguo 10/12/2008, 09:45
Avatar de gVenom  
Fecha de Ingreso: julio-2008
Ubicación: Costa Rica
Mensajes: 1.458
Antigüedad: 15 años, 9 meses
Puntos: 53
Respuesta: rotar 2 imagenes con lightbox

Cita:
Iniciado por Panino5001 Ver Mensaje
Ah, estás usando la versión 2 de lightbox. Lo que yo te puse es para la versión 1 (sin scriptaculous). Quizá sea por eso. Te toca entonces estudiar esa versión y ver cómo adaptarla.
Detalles. Es la primera vez que uso lightbox y, no soy programador, así que no podría hacer eso yo solo. Bueno, gracias por la ayuda de todas formas.
__________________
"Al que venciere y guardare mis obras hasta el fin, yo le daré autoridad sobre las naciones."
Apocalipsis 2: 26
Servicios para Pymes http://dst.co.cr
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:28.