Litebox, demasiado bueno para ser cierto

Por fin alguien diseñó un ‘lightbox’ que fuese ‘casi’ compatible con XHTML. ¿Porqué digo ‘casi’? Pues, porque al estar viendo el código fuente, me dio tanto gusto ver que lo que faltaba era dejar de usar el método innerHTML de Javascript, y usar un método más robusto

Litebox es increible. Deben usarlo para creerlo:

Goodbye, rolandog... we hardly knew yeSunsetA thousand wordsRipplesFanCarlos about to CatchWill he catch?Macro-bubble-iciousTorre en FundidoraFundidora Tower, other perspectiveHovering LightSecrets within a LeafA 'cupula'...Darned sun doesn't setStanding tallViva México!ReflectionIMG0008She's a naturalCloser...

Las modificaciones que hice las describí aquí, y puse el código acá

En resumidas cuentas, para hacer funcionar bien a esta cosa, deben seguir las instrucciones de la página donde lo consiguieron, luego editar los archivos y poner el camino absoluto a las imagenes (http://ejemplo.com/camino/a/la/imagen.gif) en los archivos lightbox.css y litebox-1.0.js. Tengan cuidado si usan WordPress: NO vayan a reemplazar su archivo style.css (en caso que lo suban a su ‘theme directory’; ese archivo no lo necesitan subir.

Si quieren que su archivo funcione de cualquier manera, deben reemplazar la función ’setInnerHTML’ por esta:

// http://www.doknowevil.net/litebox/
setInnerHTML: function(element,content) {
element = $(element);
if(element.hasChildNodes()) {
element.removeChild(element.firstChild);
}
content = document.createTextNode(content);
element.appendChild(content);
}

Y, básicamente eso es todo. También les sugiero usar un espacio en lugar de usar ‘brackets’ para poner su ‘album’… osea, por ejemplo usar el atributo rel=”lightbox album” en lugar de rel=”lightbox[album]“. Hay que hacer eso porque, de lo contrario, su XHTML no es válido… y además las funciones comparan álbumes por nombres idénticos, así que mientras tengas un espacio entre ‘lightbox’, estarás bien.

Comments (2) left to “Litebox, demasiado bueno para ser cierto”

  1. Pervasive Smothering » Blog Archive » codr: Bookmarklet and Userscript wrote:

    [...] Its been a while since I last uploaded any pictures to my Flickr account. I took some cool pictures of Water Dropplets on an icy-cold bottle of water. When I decided to share the pics here to test out the Litebox script, but since its a pain in the buttocks having to set the ‘href’ attribute to the proper image’s location (instead of the image’s Flickr page)… I decided to write a small Bookmarklet for Firefox that took care of it all, but since it was really easy to port as a Userscript, I guess I’m giving you both. codr:Bookmarklet In Firefox, drag it to your Bookmarks Toolbar. Use it when in visiting the pages of your photo sets (lots of thumbnails). or codr:Userscript Requires GreaseMonkey, a great Firefox extension. When active, will show a textbox with the code when you visit a photo set page. [...]

  2. Jon Mikel wrote:

    Simplemente no puedo hacer funcionar el litebox.
    Utilizo WordPress, así que me interesa mucho arreglar lo que comentas, pero tengo dos situaciones muy básicas y tal vez fuera de contexto:
    1. ¿Dónde descargo la carpeta?
    2. ¿A qué archivo(s) hay que editarles el código XHTML que mencionas?

    Cualquier ayuda será bienvenida; agradezco de antemano.

    Saludos,
    Jon

Post a Comment

*Required
*Required (Never published)