problema con la caja de luz

I am having problem with making my thumbnails as lightbox.

Enlace: http://www.ceanagupta.com/

The images are loaded off Flickr. After load, I want to implement the lightbox, but I am getting JavaScript error:

jQuery(".picasaGalleryItem").colorbox is not a function

Maybe this is something basic, and I am missing something.

preguntado el 27 de agosto de 11 a las 21:08

3 Respuestas

Have a look at the ColorBox Preguntas Frecuentes. If I look at the requests I see jquery.min.js dos veces.

Respondido 28 ago 11, 01:08

Thank you very much. That was the problem, and I have been looking all around. There was one more instance of jQuery being loaded from within the script. - Cruising2hell

For starters, you should wrap your jQuery code in $(document).ready like so (the DOM is not guaranteed ready at the time of execution):

$(function() { //CODE HERE });

Second, you will need to make sure that the images and containing <div> are loaded before you actually execute colorbox on those DIVs. Since you are loading the image gallery asynchronously, you will need to implement a callback function that executes after the images are loaded, with the colorbox function inside. As far as I can tell, you will need to implement this inside of your picasa.js file.

Respondido 28 ago 11, 01:08

indeed, i implemented that. helped in instant execution - Cruising2hell

The nasty solution is to replace:

    setTimeout(function(){
        jQuery(".picasaGalleryItem").colorbox();
    },2000);

con

    $(document).ready(function(){
        var _colorbox = $.colorbox;     

        setTimeout(function(){
            _colorbox.apply($('.picasaGalleryItem'));   
        }, 2000);
    });

But seriously... don't unclude jquery twice

Respondido 28 ago 11, 02:08

Thanks, the problem isnt with timeout, it was only because of the twice jquery load. - Cruising2hell

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.