Skip to main content

Lightbox and dynamic links - how and why does this work?



I had a problem, was going to ask how to fix it, but then the answer popped up in a related question. Seeing I have little experience with jQuery, I would like to understand exactly "what" happens with what I'm doing.





FYI: jQuery (latest) + jCarousel + Lightbox.





jCarousel creates a few links for me, and Lightbox captures these links and shows a nice frame around the picture I linked.





The code that did the trick was







$('a.gallery').live("click", function(e) {

$(this).lightBox({

imageLoading : 'img/lightbox-ico-loading.gif',

imageBtnClose : 'img/lightbox-btn-close.gif',

imageBtnPrev : 'img/lightbox-btn-prev.gif',

imageBtnNext : 'img/lightbox-btn-next.gif'

});

$(this).triggerHandler('click');

e.preventDefault();

});







..instead of







$('a.gallery').lightBox({

imageLoading : 'img/lightbox-ico-loading.gif',

imageBtnClose : 'img/lightbox-btn-close.gif',

imageBtnPrev : 'img/lightbox-btn-prev.gif',

imageBtnNext : 'img/lightbox-btn-next.gif'

});







My question is; what is the exact difference between these?





Thanks alot


Comments

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?