Foros del Web » Programando para Internet » Javascript »

efecto a Capa Div

Estas en el tema de efecto a Capa Div en el foro de Javascript en Foros del Web. Hola compañeros del Foro del Web, vuelvo aqui para pedir ayuda con las capas div, no soy muy habil con JavaScript y siempre termino pidiendo ...
  #1 (permalink)  
Antiguo 18/06/2011, 10:14
 
Fecha de Ingreso: enero-2011
Ubicación: Maracaibo
Mensajes: 179
Antigüedad: 13 años, 3 meses
Puntos: 2
efecto a Capa Div

Hola compañeros del Foro del Web, vuelvo aqui para pedir ayuda con las capas div, no soy muy habil con JavaScript y siempre termino pidiendo ayuda.

Tengo varias capas div, donde al cargar la pagina me muestra un grafico realizado con jpgraph y en la parte de abajo coloque otro div donde al hacer click me oculta la primera grafica y me muestra la segunda, hasta ahi todo me funciona perfecto.

La cuestion es que el cambio de una grafica a otro se ve muy violento, y quisiera saber como darle efecto a mi codigo, no se como meterle jquery a este codigo:

Código HTML:
Ver original
  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['us_id'])){
  4. header("Location: ../index.php");
  5. } else {
  6. $usuario=$_SESSION['us_id'];
  7. $admin=$_SESSION['us_tipo'];
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html xmlns="http://www.w3.org/1999/xhtml">
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  12. <title>Graficos Estadisticos</title>
  13.     <link rel=stylesheet href="./Style/default.css" type="text/css">
  14.     <link rel=stylesheet href="./Style/menuH.css" type="text/css">
  15. </head>
  16.     <script LANGUAGE="javascript">
  17.     function oculta(){
  18.      document.getElementById('mostrar').style.display = "none";
  19.     }
  20.     function muestra(){
  21.      document.getElementById('mostrar').style.display = "block";
  22.     }
  23.    
  24.      function ocultar(){
  25.      document.getElementById('titulo').style.display = "none";
  26.     }
  27.    
  28.     function mostrar(){
  29.      document.getElementById('titulo').style.display = "block";
  30.     }
  31.     function ocultar_ver(){
  32.      document.getElementById('ver').style.display = "none";
  33.     }
  34.      function mostrar_ver(){
  35.      document.getElementById('ver').style.display = "block";
  36.     }
  37.    
  38.    
  39.     </script>
  40.  
  41. <?php
  42.     include('menu.php');
  43. ?>
  44. <div align="center" id="titulo"> <strong> GRAFICOS ESTADISTICOS DE TAREAS TERMINADAS</strong>
  45. <div><img src="graficos/graph_tarea_dia.php" alt="" border="0"></div>
  46. </div>
  47.  
  48. <div align="center" onclick="muestra(); ocultar(); ocultar_ver()" style="cursor:pointer"> <strong> <label id="ver">(vea)</label> GRAFICO ESTADISTICO POR RECURSO</strong> </div>
  49.   <div id="mostrar" style="display:none">
  50.    <img src="graficos/graph_tarea_recurso.php" alt="" border="0"> </br>
  51.  
  52.   <span id="cerrar"  style="color:#000; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size:17px">Cerrar Grafico <label onclick="oculta(); mostrar(); mostrar_ver()" style="cursor:pointer">[X]</label></span>
  53. </div>
  54. </body>
  55. </html>
  56. <? } ?>

No soy muy bueno en JavaScript y el codigo pueder de un novato

Espero puedan ayudarme con esto


Saludos
  #2 (permalink)  
Antiguo 18/06/2011, 10:35
 
Fecha de Ingreso: abril-2011
Mensajes: 1.342
Antigüedad: 13 años
Puntos: 344
Respuesta: efecto a Capa Div

Puedes usar fadeOut y fadeIn para hacerlo menos tosco:

Código Javascript:
Ver original
  1. <div align="center" id="titulo"> <strong> GRAFICOS ESTADISTICOS DE TAREAS TERMINADAS</strong>
  2. <div><img src="graficos/graph_tarea_dia.php" alt="" border="0"></div>
  3. </div>
  4.  
  5.     <div align="center" onclick="$('#mostrar').fadeIn();$('#titulo').fadeOut();$('#ver').fadeOut();" style="cursor:pointer"> <strong> <label id="ver">(vea)</label> GRAFICO ESTADISTICO POR RECURSO</strong> </div>
  6.   <div id="mostrar" style="display:none">
  7.    <img src="graficos/graph_tarea_recurso.php" alt="" border="0"> </br>
  8.  
  9.   <span id="cerrar"  style="color:#000; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size:17px">Cerrar Grafico <label onclick="$('#mostrar').fadeOut(); $('#titulo').fadeIn();$('#ver').fadeIn();" style="cursor:pointer">[X]</label></span>
  10. </div>
  #3 (permalink)  
Antiguo 22/06/2011, 04:47
 
Fecha de Ingreso: enero-2011
Ubicación: Maracaibo
Mensajes: 179
Antigüedad: 13 años, 3 meses
Puntos: 2
Respuesta: efecto a Capa Div

Hola alexg88, muchas gracias, me sirivio mucho tu ayuda,

Saludos

Etiquetas: efecto, 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 15:55.