Foros del Web » Programando para Internet » Javascript »

Efecto en capa

Estas en el tema de Efecto en capa en el foro de Javascript en Foros del Web. Chicos tengo una duda, me colaboran por favor Tengo una capa que se abre al presionar un boton, funciona bien. Quisiera saber si es posible ...
  #1 (permalink)  
Antiguo 11/12/2012, 09:56
 
Fecha de Ingreso: noviembre-2010
Mensajes: 204
Antigüedad: 13 años, 5 meses
Puntos: 1
Efecto en capa

Chicos tengo una duda, me colaboran por favor

Tengo una capa que se abre al presionar un boton, funciona bien.

Quisiera saber si es posible tener un efecto sobre la capa de forma tal que se abra/cargue no de forma instantanea como lo hace en este momento, si no que se abra/cargue en forma mas elegante por ejemplo en forma de cortina de "arriba hacia abajo"

Código HTML:
Ver original
  1.  
  2.  
  3. <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
  4.  
  5. <title>Prueba</title>
  6.  
  7. <script type="text/javascript">
  8.        
  9. function abrir_capa()
  10. {
  11.    var ventana = document.getElementById('capa');
  12.    ventana.style.display = 'block';
  13. }
  14.  
  15. function cerrar_capa()
  16. {
  17.     var ventana = document.getElementById('capa');
  18.     ventana.style.display = 'none';
  19. }
  20.  
  21.  
  22. </head>
  23.  
  24. <div><a id="boton" href="javascript:abrir_capa()">Abrir capa</a></div>
  25.  
  26. <div id="capa" style="position: fixed; width: 350px; height: 350px; top: 50; left: 250; font-family:Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; border: #333333 1px solid; background-color: #FFFFFF; color: #000000; display:none;">
  27.  <div style="font-weight: bold; text-align: left; color: #FFFFFF; padding: 5px; background-color:#006394">Capa</div>
  28.  
  29. <center>** abc **</center>
  30.  
  31.  <div style="padding: 4px; text-align: center; margin-top: 275px;"><input onclick="cerrar_capa" name="btnAceptar" size="20" type="button" value=" Cerrar " /></div>
  32. </div>
  33.  
  34. </body>
  35. </html>

Gracias

Última edición por isabelramirezmontoya; 11/12/2012 a las 10:03
  #2 (permalink)  
Antiguo 11/12/2012, 10:03
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: Efecto en capa

Revisa este tema, es parecido a lo que necesitas:
http://www.forosdelweb.com/f13/despl...oculto-605959/
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
  #3 (permalink)  
Antiguo 11/12/2012, 15:32
Avatar de IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Efecto en capa

puede ser un efecto cortina que aumente horizontal y después verticalmente
Cita:
<!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=utf-8" />
<title></title>
<style type="text/css">
* {
margin: 0;
padding: 0;
border: none;
position: relative;
}

html, body {
width: 100%;
height: 100%;
}


.contenedor {
width: 100%;
height: auto;
background-color: rgba(109, 106, 107, 0.85);
}



.contenedor span {
float:left;
}


.contenedor span.url {
width: 26px;
height: 28px;
margin: 0 7px;
}


.contenedor span.url a img {
width: 26px;
height: 28px;
border: 1px solid #FFF;
z-index: auto;
}


.contenedor span.url a:hover img {
z-index: 99;
}


.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
</style>
<script type="text/javascript">
function Evento(elemento,nomevento,funcion) {

var fct=function(){
funcion.call(elemento,window.event);
}
elemento.attachEvent('on'+nomevento,fct);
return true;

}




window.onload = function() {

var thumb = document.querySelector('.contenedor').getElementsB yTagName('img');
for (var i = 0; i < thumb.length; i++) {

if(document.addEventListener) {

thumb[i].addEventListener('mouseover', function() {this.style.zIndex = 99; transAumenta(this, parseInt(document.defaultView.getComputedStyle(thi s, null).getPropertyValue('width')), parseInt(document.defaultView.getComputedStyle(thi s, null).getPropertyValue('height')))}, false);
thumb[i].addEventListener('mouseout', function() {clearTimeout(intervalo); this.style.border = "1px solid #FFF"; transDisminuye(this, parseInt(this.style.width), parseInt(this.style.height))}, false);


} else { // ie8-


Evento(thumb[i], 'mouseover', function() {this.style.zIndex = 99; transAumenta(this, parseInt(document.styleSheets[0].rules[5].style['width']), parseInt(document.styleSheets[0].rules[5].style['height']))});
Evento(thumb[i], 'mouseout', function() {clearTimeout(intervalo); this.style.border = "1px solid #FFF"; transDisminuye(this, parseInt(this.style.width), parseInt(this.style.height))});

}

}
};



var intervalo;

function transAumenta(bloque, ancho, alto) {

if (ancho <= 90) {
ancho +=3;
bloque.style.width = ancho + 'px';
intervalo = setTimeout(function(){transAumenta(bloque, ancho, alto)}, 8);

} else if (alto <= 97) {
alto += 3;
bloque.style.height = alto + 'px';
intervalo = setTimeout(function(){transAumenta(bloque, ancho, alto)}, 8);
}

}



function transDisminuye(bloque, ancho, alto) {

if (alto >= 31) {
alto -= 3;
bloque.style.height = alto + 'px';
setTimeout(function(){transDisminuye(bloque, ancho, alto)}, 8);

} else if (ancho >= 29) {
ancho -=3;
bloque.style.width = ancho + 'px';
setTimeout(function(){transDisminuye(bloque, ancho, alto)}, 8);

} else {
bloque.style.zIndex = 'auto';
}
}
</script>
</head>
<body>

<div class="contenedor clearfix">
<span class="url"><a href="" target="_blank"><img src="http://r0k.us/graphics/kodak/thumbs/kodim01t.jpg" title="i1" alt="i1"></a></span>
<span class="url"><a href="" target="_blank"><img src="http://r0k.us/graphics/kodak/thumbs/kodim02t.jpg" title="i2" alt="i2"></a></span>
<span class="url"><a href="" target="_blank"><img src="http://r0k.us/graphics/kodak/thumbs/kodim03t.jpg" title="i3" alt="i3"></a></span>
<span class="url"><a href="" target="_blank"><img src="http://r0k.us/graphics/kodak/thumbs/kodim05t.jpg" title="i4" alt="i4"></a></span>
</div>

</body>
</html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}

Última edición por IsaBelM; 11/01/2013 a las 17:40 Razón: unas mejoras

Etiquetas: efecto, funcion, html, input, capas
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 07:15.