Ver Mensaje Individual
  #2 (permalink)  
Antiguo 20/10/2011, 14:58
Avatar de morfasto
morfasto
 
Fecha de Ingreso: julio-2011
Ubicación: Lima
Mensajes: 291
Antigüedad: 12 años, 9 meses
Puntos: 8
Respuesta: lightbox creador por mi

Olvide poner mi codigo:

Código HTML:
Ver original
  1. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  2. <title>CSS Lightbox</title>
  3. <script type="text/javascript" language="javascript">
  4.    var http_request = false;
  5.    function makePOSTRequest(url, parameters, funcion) {
  6.       http_request = false;
  7.       if (window.XMLHttpRequest) { // Mozilla, Safari,...
  8.          http_request = new XMLHttpRequest();
  9.          if (http_request.overrideMimeType) {
  10.             // set type accordingly to anticipated content type
  11.             //http_request.overrideMimeType('text/xml');
  12.             http_request.overrideMimeType('text/html');
  13.          }
  14.       } else if (window.ActiveXObject) { // IE
  15.          try {
  16.             http_request = new ActiveXObject("Msxml2.XMLHTTP");
  17.          } catch (e) {
  18.             try {
  19.                http_request = new ActiveXObject("Microsoft.XMLHTTP");
  20.             } catch (e) {}
  21.          }
  22.       }
  23.       if (!http_request) {
  24.          alert('Cannot create XMLHTTP instance');
  25.          return false;
  26.       }
  27.      
  28.       http_request.onreadystatechange = funcion;
  29.       http_request.open('POST', url, true);
  30.       http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  31.       http_request.setRequestHeader("Content-length", parameters.length);
  32.       http_request.setRequestHeader("Connection", "close");
  33.       http_request.send(parameters);
  34.    }
  35.  
  36.    function alertContents() {
  37.       if (http_request.readyState == 4) {
  38.          if (http_request.status == 200) {
  39.             //alert(http_request.responseText);
  40.             result = http_request.responseText;
  41.             document.getElementById('content').innerHTML = result;            
  42.          } else {
  43.             alert(http_request.status);
  44.          }
  45.       }
  46.    }
  47.    function get() {
  48.       var poststr = "mes";
  49.       makePOSTRequest('fotos.php', poststr, alertContents);
  50.    }
  51.  
  52. function showLightbox() {
  53.     document.getElementById('over').style.display='inline';
  54.     document.getElementById('fade').style.display='block';
  55. }
  56. function hideLightbox() {
  57.     document.getElementById('over').style.display='none';
  58.     document.getElementById('fade').style.display='none';
  59. }
  60. <style type="text/css">
  61. body {
  62.     background-color: #FFFFFF;
  63.     font-family: "Trebuchet MS", Tahoma, Verdana;
  64.     font-size: 12px;
  65.     font-weight: normal;
  66.     color: #666666;
  67.     margin: 10px;
  68.     padding: 0;
  69. }
  70. .fadebox {
  71.     display: none;
  72.     position: absolute;
  73.     top: 0%;
  74.     left: 0%;
  75.     width: 100%;
  76.     height:100%;
  77.     background-color: black;
  78.     z-index:1001;
  79.     -moz-opacity: 0.8;
  80.     opacity:.80;
  81.     filter: alpha(opacity=80);
  82. }
  83. .overbox {
  84.     display: none;
  85.     position: absolute;
  86.     top: 0%;
  87.     left: 25%;
  88.     width: auto;
  89.     z-index:1002;
  90. }
  91. #content {
  92.     background: #FFFFFF;
  93.     border: solid 3px #CCCCCC;
  94.     height:auto;
  95.  
  96. }
  97.  
  98. </head>
  99. <p><a href="javascript:showLightbox();get();">Show LightBox</a></p>
  100. <div id="over" class="overbox">
  101.     <div id="content">
  102.     </div>
  103. </div>
  104. <a href="javascript:hideLightbox();"<div id="fade" class="fadebox">&nbsp;</div></a>
  105. </body>
  106. </html>

La informacion del lightbox se carga con AJAX cuando se aprieba el link Show Lightbox