Sexy Lightbox is a more lightweight and sexier clone of the classic Lightbox. It was constructed thinking about web designers, easy installation and use.
This version is now compatible with images and HTML elements!
Now, Sexy Lightbox is compatible with HTML! That means that you can show elements, pages, videos, and all what you want!
Also, large images (very large images
) are automatically adjusted to window.
Now: Areamaps compatible!
Sexy Lightbox 2 requires Mootools 1.2.3 or jQuery 1.3.2, and is compatible with all modern browsers (and Internet Explorer).





You can view the demo here:
SexyLightbox 2 is compatible with the following lightboxes, because it was constructed using the same logic:
Note: This version is NOT compatible with Sexy Lightbox 1.
Upload all Sexy LightBox 2 files to your host. The images, CSS and Javascript, if you locate the images folder in a different directory you should change the path in the “dir” parameter in the class. Below explains how
Write the following code between the HEAD tag in your page:
For Mootools:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.3/mootools-yui-compressed.js"></script> <script type="text/javascript" src="sexylightbox.v2.3.mootools.js"></script> <link rel="stylesheet" href="sexylightbox.css" type="text/css" media="all" />
Atention: To save bandwidth, you can use the compressed version of SexyLightBox, you should to include the file “sexylightboxv.2.3.motools.min.js”
For jQuery:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="jquery.easing.1.3.js"></script> <script type="text/javascript" src="sexylightbox.v2.3.jquery.js"></script> <link rel="stylesheet" href="sexylightbox.css" type="text/css" media="all" />
Atention: To save bandwidth, you can use the compressed version of SexyLightBox, you should to include the file “sexylightboxv.2.3.jquery.min.js”
Finally, add the following code just below of the last lines:
For MooTools:
<script type="text/javascript">
window.addEvent('domready', function(){
SexyLightbox = new SexyLightBox();
});
</script>
For jQuery:
<script type="text/javascript">
$(document).ready(function(){
SexyLightbox.initialize();
});
</script>
To use Sexy Lightbox 2 is easy! just add the property rel=”sexylightbox” to your links:
<a href="imagen.jpg" title="some title" rel="sexylightbox">View image</a>
Optional: Use the “title” property if you want to show a description for the image.
The keyword “sexylightbox” can be changed with the “find” property. Read the section General config to learn how to do it.
If you want to create a galery from a links group, you should include the gallery name between brackets in the property “rel”:
<a href="senorms.jpg" rel="sexylightbox[galeria]">Link 1</a> <a href="imagen.jpg" rel="sexylightbox[galeria]">Link 2</a> <a href="cualquiera.jpg" rel="sexylightbox[galeria]">Link 3</a>
There is no limit in the galeries quantity.
There are 3 ways to show HTML content in the lightbox:
This is the default way. Parameters “width” & “height” are required:
<a href="http://www.yoursite.com/view.php" rel="sexylightbox">
Link 1
</a>
The correct way is specifying the height and width:
<a href="http://www.yoursite.com/view.php?width=400&height=200" rel="sexylightbox">
Link 1
</a>
Besides the “width” and “height” you should pass the parameter “TB_iframe”:
<a href="http://www.yoursite.com/view.php?TB_iframe=1&width=400&height=200" rel="sexylightbox">
Link 1
</a>
The link should start with “#TB_inline?inlineId=ID” where ID is the id of wrapper who has the HTML to show.
<div id="MyHTML"> Example </div>
<a href="#TB_inline?inlineId=MyHTML&height=125&width=350" rel="sexylightbox">
Link 1
</a>
HTML content and Images support the following parameters:
Setting modal=1 the lightbox will be close only clicking the button “close”, disabling the click event to overlay
<a href="image.jpg?modal=1" rel="sexylightbox">Link 1</a>
Set the background color to the lightbox. Very useful when the HTML content loaded has a different background than white.
<a href="#TB_inline?inlineId=MyHTML&height=125&width=350&background=#00FF00" rel="sexylightbox">Link 1</a>
Show a legend below the content or image. Using this method it’s not possible insert html in the legend.
<a href="imagen.jpg?title=Verano del 98" rel="sexylightbox">Link 1</a>
The SexyLightbox class is very flexible. Read the following documentation to view all available options.
The following options are available for the class creation:
The css style is for the black background (it’s fade). You can change the color and the opacity.
SexyLightbox = new SexyLightBox({
OverlayStyles:{
'background-color':'#fff',
'opacity': 0.6
}
});
For jQuery:
SexyLightbox.initialize({
OverlayStyles:{
'background-color':'#fff',
'opacity': 0.6
}
});
Sexy Lightbox has two releases, the white and a black one. By default, it uses the black, but you can configure it to use it with white.
It admits: “black”, “white”, “blanco” or “negro”. By default it uses “black”. This option is used to locate images that will be used in the directory “sexyimages”.
For MooTools:
SexyLightbox = new SexyLightBox({color:'white'});
For jQuery:
SexyLightbox.initialize({color:'white'});
It admits: “top” or “bottom”. By default it uses “top”. If you want the lightbox display “from bottom” use “bottom”.
MooTools:
SexyLightbox = new SexyLightBox({emergefrom:'bottom'});
jQuery:
SexyLightbox.initialize({emergefrom:'bottom'});
Keyword used to search in the links where lightbox is going to be applied. By default is used “sexylightbox”. This option allows you to create different instances of lightbox and it can use each one in different links. Also, it allows the compatibility with the original lightbox, the keyword is “lightbox”.
MooTools:
SexyLightbox = new SexyLightBox({find: 'lightbox'});
jQuery:
SexyLightbox.initialize({find: 'lightbox'});
Name of the directory that contains the images style. In this directory, you can found the colors directory (black and white). If you want to rename or relocate this directory in another folder, you should change this property.
MooTools:
SexyLightbox = new SexyLightBox({dir: 'folderimages'});
jQuery:
SexyLightbox.initialize({dir: 'folderimages'});
MooTools:
window.addEvent('domready', function(){
SexyLightbox = new SexyLightBox({
find : 'sexylightbox', // rel="sexylightbox"
color : 'negro',
dir : 'http://www.yoursite.com/images/',
emergefrom : 'bottom',
OverlayStyles : {
'background-color': '#FF0000',
'opacity' : 0.3
}
});
});
jQuery:
$(document).ready(function(){
SexyLightbox.initialize({
find : 'sexylightbox', // rel="sexylightbox"
color : 'negro',
dir : 'http://www.yoursite.com/images/',
emergefrom : 'bottom',
OverlayStyles : {
'background-color': '#FF0000',
'opacity' : 0.3
}
});
});
You can access to the lightbox from javascript, thru the following functions:
Close the lightbox (if is open).
SexyLightbox.close();
Shake the lightbox. Useful to show any error.
SexyLightbox.shake();
Scans the DOM again looking for new links, to be opened with lightbox.
SexyLightbox.refresh();
display(url, title, force)
Opens the lightbox in the url sent. The “force” parameter (force=’image’), forces to show the lightbox as an image.
SexyLightbox.display('images/mysql.jpg');
SexyLightbox.display('images/captcha.php', '', 'image');
Animated gifs doesn’t work in Opera
It’s an Opera’s problem, that doesn’t fire the “onload” event when the gif is loaded. Nevertheles, once the gif is stored in cache, the event is fired correctly, so the image is shown with no problems. In other words, it doesnt have a solution.
The flash object is shown over the “overlay”
To solve this, you have to change the property wmode to transparent or opaque.
If you are using Adobe’s script, you should have something like:
AC_FL_RunContent( 'codebase', 'http...', 'pluginspage', 'http...', 'width', '999', 'height', '999', 'src', 'images/home', 'movie', 'images/home', 'quality', 'high', 'wmode', 'transparent' ); //end AC code
var so = new SWFObject("home.swf", "home", "999", "999", "9", "#222222");
so.addParam("allowfullscreen", "true");
so.addParam("allowScriptAccess", "always");
so.addParam("wmode","transparent");
If not, you are using the flash object as it is, you should have something like:
Notice that “wmode” is included in the embed and as “param”
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http..." width="999" height="999"> <param name="movie" value="images/home.swf" /> <param name="quality" value="high" /> <param name="wmode" value="transparent" /> <embed src="images/home.swf" width="999" height="999" quality="high" pluginspage="http..." type="application/x-shockwave-flash" wmode="transparent"></embed> </object>
Overlay opens but previous, next, and/or close links are missing
The script is published under the license MIT.
You can view the demo here:
Nothing
. But you can collaborate, buying me a coffee ![]()
Este artículo contiene los siguientes archivos:
Sexy Lightbox 2.3.4 - Noviembre 10, 2009
* BugFixed: Corregida la compatibilidad con la propiedad "dir" y "sexyimages" en jQuery
Sexy Lightbox 2.3.3 - Octubre 30, 2009
* BugFixed: Corregida la compatibilidad con la propiedad "dir" y "sexyimages"
Sexy Lightbox 2.3.2 - Octubre 29, 2009
* BugFixed: En IE6 con el shim se quedaba en "cargando..."
* BugFixed: Corregido el sistema de galería, que se arruinó en la anterior versión xD.
Sexy Lightbox 2.3.1 - Octubre 28, 2009
* BugFixed: Arreglado el error en Safari/Chrome cuando el tamaño de la ventana
era menor que la del documento el overlay no tapaba todo, con jQuery.
* BugFixed: Arreglado el error cuando no había titulo pero si era galería, el alto no
correspondía al alto de la imagen.
* BugFixed: Eliminada la función stopImmediatePropagation en la versión de jQuery.
Sexy Lightbox 2.3 - Octubre 15, 2009
* Featured: Clase Overlay reescrita desde 0 basada en la oficial de mootools
* Featured: Nuevo estilo visual para Black & White
* Featured: Nueva propiedad "emergefrom"
* Featured: Las imágenes pueden abrirse con un tamaño fijo, al igual que el contenido html
* Featured: Se precargan las imagenes del estilo, antes de mostrar el lightbox
* BugFixed: zIndex cambiado a 32000 para compatibilizar con SexyAlertBox
* BugFixed: propiedad "imagesdir" sustituída por "dir"
* BugFixed: El lightbox ya no aparece del top=0, sino de arriba del scroll,
dando un efecto mas suave al movimiento.
* BugFixed: Función "display" cambiada a "animate"
* BugFixed: ahora el ajax recibe el parámetro background
* BugFixed: ahora el Overlay recibe el tamaño correcto en Chrome
* BugFixed: Flash & Selects no se ocultan. Si desea ocultar un flash debe establecer
la propiedad wmode=transparent manualmente.
* BugFixed: Tamaño de imagenes y html se setean correctamente ahora.
Sexy Lightbox 2.2 - Junio 1, 2009
* Featured: Rounded corners more smooth
* Featured: Nueva función Refresh().
* Featured: Nueva función Shake().
* Featured: Agregado Modalbox style.
* BugFixed: El contenido/iframe permanecían con el background de la imagen anterior.
* BugFixed: Background negro en Loading, después de ver un video.
* BugFixed: Ajax 404 error.
* Now Compatible with mootools 1.2.2
* Now Compatible with jQuery 1.3.2
Sexy Lightbox 2.1 - Febrero 20, 2009
* Featured: Se ejecuta el js que se incluyan con el ajax.
* Featured: Compatibilidad con teclado (Flechas y tecla ESC)
* Featured: Ahora los contenidos html se pueden agrupar en galerias.
* Featured: Ahora puedes especificar el color de fondo del Lightbox.
* Featured: Si la página pedida por ajax no existe, devuelve 404.
* BugFixed: Posición centrado absoluto.
* BugFixed: IE7 Bug Scroll con overflow:auto.
* BugFixed: Los elementos flash (video), ya no se siguen reproduciendo.
* BugFixed: Arreglado el bug de posición. Ahora el lightbox siempre vendrá de arriba.
* BugFixed: Google Chrome mostraba 2px más de lo que debía.
* Arreglado el CSS para mas compatibilidad.
* Ahora la altura y ancho especificados son del innerDIV y no del Lightbox en total.
* Los eventos se han eliminado.
* El código se ha ordenado listo para codearlo en jQuery.
* Nueva función Close() para cerrar el lightbox.
Sexy Lightbox 2.0.1 - Octubre 15, 2008
* Arreglada Compatibilidad con Opera (overflow: 'visible')
* Posibilidad de agregar código HTML en la propiedad Title
Sexy Lightbox 2.0.0 - Octubre 12, 2008
* Versión Inicial 2
No temirno de entender porqué no me funciona con el ie8 y con el firefox si. A alguien le ocurre lo mismo?
Utiliza la versión de mootools. Esta tabaja bien en IE8
Seguir todos los pasos, utilizando jquery.. todo subido a un servidor y pegado antes de con la ultima version jquery 1.3.2 y no hay manera de que funcione en IE8, haber si alguien me puede orientar,gracias.
Ola,
Todo me parese muy interesante, pero mi español no esta bastante bueno para comprender bien este articolo.
Hay este articolo en inglés tambien?
Gracias!
Rolf (Olanda)
How stupid! Completely overlooked the translation option above!
Forget my previous post.
Hi,
I like Sexy-Light box very much!
I’d like to know whether is is possible
1: to use a background image for the box
2: how can I make it to automatically size to its content. If I don’t know in advance, then setting the height and width in the href may result in a box which is too big or too small.
Cheers,
Jos
Cuando cierro la ventana, como puedo actualizar la pagina padre
BUEN TRABAJO DOC LO FELICITO, MI CONSULTA ES Q CUANDO LO CORRO EN IE 8 NO ME FUNCIONA, HABRIA Q MODIFICAR ALGO PORQ ARRIBA EN LA PARTE DONDE ESTA LA COMPATIBILIDAD DE NAVEGADORES ME PONER IE 6,7,8
GRACIAS
hola tengo una pregunta como puedo modificar el tamaño de slb ya abierto gracias XD ..
Yo hice la misma pregunta, a ver si hay suerte y alguien nos resuelve el misterio….
En IE6 funciona pero no salen las esquinas ni la parte inferior de la ventana donde sale el title..
hola!!
tngo un problemilla no me aparece la barra de carga de imagenes como la pongo o que archivo es?!
agradezco su ayuda!
Hola.
Tengo un menú, donde al presionar sobre alguna de sus opciones, se carga mediante ajax una galería determinada.
El problema que tengo, es que en ninguna de esas galerias puedo usar SLB.
Se supone que las galerias deberían heredar desde la página padre (donde tengo el div), las librerias de SLB y los estilos, pero nada de eso pasa. Alguien ha pasado por esto??
El código que tengo en las galerias es algo como esto:
Lo que hace, al menos sin usar ajax, es mostrar la imagen y una descripción de esta. Ojalá me puedan ayudar.
Saludo.
Hola, he buscado en las 10 paginas de comentarios y no encuentro la solución a mi problema, a ver si me pueden hechar una mano.
Tengo una pagina con frames: frame1 y frame2. Abro el sexy lightbox desde frame2. El SLB muestra un archivo externo en php, un pequeño formulario que cuando se envie, quiero que se refresque el contenido del frame2.
Uso el siguiente código:
Pero lo único que consigo es que que desaparezcan los frames y el formulario del sexy lightbox se carge a pantalla completa.
¿Como puedo hacer para volver a cargar (refresh) solamente el contenido del frame2?
Muchas gracias!
a ver intentaste con esto:
o con esto:
no me acuerdo como se hacía pero por ese lado iba la cosa ^_^ espero lo logres solucionar
QUE BUENO!!!!
No sabes cuanto me alegra buscar un script, y enterarme que el MEJOR de todos (de 20 que mire) esta hecho por un Argentino!!!!
Y no solamente me encanta que el programador sea argentino, sino que ademas este ponga fotos de nuestro pais!!!
Vamos Argentina carajo!!!
Abrazo grande y muchas felicitaciones,
Rodrigo de Belgrano.
jajaja gracias papá
un abrazo desde Quilmes
Que tal… esperaba que talvez alguien me pueda ayudar… implemente un sexylightbox para un sitio y ahora deseo agregarle informacion a la imagen, ademas del “title”, necesito agregar una descripcion dentro del lightbox correspondiente a la imagen… alguien tiene alguna idea?
Sipo. Mira esta página:
Busca donde dice “inline content”. De esa forma se puede agregar contenido html en SLB. En todo caso, es algo como esto:
Saludos.
muchas gracias… lo he resuelto… felicitaciones de nuevo y gracias por tu tiempo
Eduardo que tal.
Buscando un par de cosas que necesito hacer con slb, como por ejemplo que desde la ventana slb, pudiera abrirse otra ventana para mostrar otra página he hallado el siguiente script, del cual os dejo el link, para ver si te sirve como ejemplo de todo lo que se puede ir añadiendo a tu maravilloso slb.
http://randomous.com/floatbox/demo
ummmmm realmente muy interesante serio super que todos esos ejemplos sean implementaran al slb .
me sorprendio ese ejemplo en la cual le ingresas un dato a un text y al pulsar el boton te sale otra ventana pero no en toda la pantalla sino que solo en una parte de toda la ventana estupendo xD …………
esta muy bueno gracias por el dato
Me pueden enviar un formulario sin que cerrar antes o, incluso, presentar y cerrar?
Hola Eduardo.
Estoy muy agradecido por el material que dejas a disposicion en tu web, ademas el tutorial esta buenisimo..
Estuve intentando poner en practica el sexylightbox y funciona perfecto .. salvo por un pequeño detalle .. el borde superior izquierdo queda al descubierto y la “pieza” que cubre esa esquina se posiciona al centro del borde superior .. ¿como lo puedo solucionar?
Te dejo la pagina de demos, no te mueras por el color, pero frecuentemente uso colores radioactivos para ver mas facil sin hay algo fuera de lugar …
De antemano mil gracias por tu tiempo…
Efectivamente, hay un error en el código CSS.
Temporalmente lo puedes solucionar abriendo el archivo :
sexylightbox.css (línea 50)
en la clase:
#SLB-Wrapper #SLB-Top div { ...deberías agregar esto:
En la próxima versión que voy a sacar ya viene arreglado.
Olvide el link de la pagina…
Demo
Muchisimas gracias!!!
ya esta listo … miralo
que tengas un buen dia
Hola, qué tal? Quería hacer una pregunta. Tengo un problema con un sitio que estoy actualizando. Está realizado con sexylightbox 2.1, y tengo que cambiar una de las fotos. Si la foto es chica, no hay problema, pero si es grande le hace un resize del tamaño que quiere, sin importar lo que yo le especifique en: ej:<a href="aquiles blunt to fackie.jpg?TB_iframe=true&height=20&width=10" rel="sexylightbox", le ponga lo que le ponga sigue el problema. Qué puedo hacer?
Desde ya muchas gracias!!!!
Es que la versión que estás usando justamente no trae para esa opción.
Especificar el tamaño de una imagen por parámetros es algo de la nueva versión, y la razón por la que no te toma el TB_iframe es porque la comprobación de si es una imagen o no viene primero.
Hola, muchas gracias por tu respuesta, ya resolvi el problema. La cuestion era que estaba mostrando contenido html y yo lo estaba laburando como jpg.
Ahora tengo otra duda: hay manera de linkear un boton desde fireworks al sexy lightbox? Es un boton que tiene hecho un over, y cuando vuelco todo al dreamweaver no funcionan ambas cosas a la vez: o funciona el over pero no el sexy lightbox o visceversa. Me podes tirar alguna idea?
Muchas gracias por tu aporte y por responder a todas nuestras dudas!!!
Saludos
Lorena
oe brother como puedo hacer para que a la hora de dar click en cerrar del slb me actualize la ventana padre
Hola!!
Me encanta este script, pero me gustaría saber cómo hacer para que lea las tildes!!!
… agradecería mucho tu ayuda
Un abrazo desde Colombia!!
Quiero sabe como ejecutar como si fuese un alert
el light box
hola me gusto mucho el slb pero tengo una duda, uso base de datos y ejecuto el slb desde javascript por que uso iframes, ahora me gustaria saber como puedo hacer un salto de linea en el slb para poder separar el titulo de la descripcion de la imagen, espero y me puedan ayudar
Ya probaste utilizando la etiqueta de salto de linea:
Hello
I have a list of mp3 file I’d like people to be able to listen to in an jw Player info inline in the lightbox overlay – any ideas how I would go about this?
thank you in advance for your help.
I’m currently using Mediabox Advanced and it’s quite easy to set it up.
Muchas Gracias! Eduardo, sólo una duda al intentar instalarlo me sale este mensaje en joomla 1.5.15–> ¡Error! No puedo encontrar un archivo de configuración XML en el paquete
In the sexyimages black and white folders has bgSexy.gif.png(2 file extensions) and bgSexy.png
It should include bgSexy.gif and bgSexy.png correct?
Si, es como Bob dice, para que funcione bien en IE, hay que renombrar bgSexy.gif.png (en las carpetas black y white) a bgSexy.gif
Saludos!
Hola, que tal?
Quisiera hacer una consulta. He intentando de varias formas poner rel=”sexylightbox” a unas imagenes que estan en una pagina dentro de una ventana para que el slb se muestre en la ventana padre con onclick=”window.parent.SexyLightbox.display(’imagen.jpg’); return false;” , pero no se forma el grupo de enlaces… Que podria hacer, desearia alguna sugerencia
De antemano gracias!!!!
La parte del código que explicas arriba no la comprendo, ya que al copiar y pegar eso en el Head de la página y agregando los archivos CSS y JS que trae el comprimido, no funciona nada de verdad que no se que paso me estoy saltando.
En el efecto SexyLightbox v.1 el comprimido trae además de los JS y CCS, trae el script completo que debo colocar en el head de la página y al copiarlo y pegarlo funciona.
Soy novato y en vista de eso me rijo al 100% de los pasos que colocas en tu explicación, Gracias.
Hola.
Quizás deberías revisar las rutas de esos archivos. Podrías poner el código que pegaste para ver dónde podría estar el error, porque SLB si funciona.
Saludos.
Hi Eduardo! First thanks for your great script. I find a stange thing, don’t know if it’s a bug. I place my thumb image on a folder and my big image on a subfolder on the same folder. With this way gallery function can’t work (next and prev link doesn’t display. I must put my thumb and big image on same folder to get gallery function working. Hope you understand what I mean and tell me if it’s “normal”. Thanks. Aysseline