[jQuery] Problem with Thickbox plugin

2007-01-09 Thread Abel Tamayo

Ok, this is rather strange:
I begin with a list of images like this:

ul class=list_images
   liimg src=images/imag1.png//li
   liimg src=images/imag2.png//li
   liimg src=images/imag3.png//li
/ul

then I include the following piece of jQuery script at $(document).ready:

$(.list_images img).each(function(){$(this).wrap(a
href='+$(this).attr(src)+' class='thickbox'/a);});

as expected, the result is the following modified list, right what I needed
to be able to apply the thickbox effect:

ul class=list_images
   lia class=thickbox href=images/imag1.pngimg
src=images/imag1.png//a/li
   lia class=thickbox href=images/imag2.pngimg
src=images/imag1.png//a/li
   lia class=thickbox href=images/imag3.pngimg
src=images/imag3.png//a/li
/ul

Everything is working smoothly so far, but when I load the page in Firefox
and click on the images, the lightbox doesn't appear at all and I'm
redirected to a blank page with only the image I expected to see (not the
effect I'm looking for). Plus, Firebug warns me that theres an error, but
I've investigated it and it doest the same everytime you try to load an
image in Firefox when it's not inside a HTML document.
And this is when things get freaky: I copy-paste that modified list into a
blank document, load it and guess what: it works! But why can't I generate
the list dynamically? I'm trying to separate content from presentation in
three layers (HTML, script and CSS), so I would really like to make it work.
Plus, it's driving me crazy.

Thanks in advance.
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problem with Thickbox plugin

2007-01-09 Thread Mike Alsup
 Plus, it's driving me crazy.

Be aware that thickbox also uses $(document).ready().  If it runs
before your code then things won't work.  You may need to do this so
that your doc-ready is registered first:

script type=text/javascript src=jquery.js/script
script type=text/javascript
$().ready(function() {
$(.list_images img).each(function() {
$(this).wrap(a href='+$(this).attr(src)+' class='thickbox'/a);
});
});
/script
script type=text/javascript src=thickbox.js/script

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] Problem with Thickbox plugin

2007-01-09 Thread Abel Tamayo

I can't believe it, but that TB_init() call after unbinding the event works.
I don't understand very well why, but thanks for your help, Sam.
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/