One question I've got about the Thickbox/Lightbox libraries...

Currently there's no way to bookmark an image on a specific page. Does
anyone have any ideas about how to create a link that will load the correct
page, but auto-display the chosen image?

That's the main thing keeping me from using one of these systems.

<!----------------//------
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Dylan Verheul
Sent: Monday, September 04, 2006 12:30 AM
To: jQuery Discussion.
Subject: [jQuery] Thickbox 2.0 and dynamic content


I think I've seen this subject before, so I thought I'd share my solution.

Case:
- I want to use Thickbox
- Some of my content is dynamically provided through AJAX
- The Thickbox urls in the AJAX content aren't thickboxed in
$(document).ready()
- Thickboxing twice gives me errors

My solution:
I changed the TB_init from Thickbox to:

function TB_init(elem) {
        if (!elem) elem = document;
        $("a.thickbox", elem).click(function() {
                var t = this.title || this.name || null;
                var g = this.rel || false;
                TB_show(t,this.href,g);
                this.blur();
                return false;
        });
}

Now I can provide this function with a DOM element to search in. So
when I load content into <div id="ajaxHere"></div>, I can call
TB_init($("#ajaxHere")[0]).

I might even extend this by adding a $.fn.thickbox that does this for
the entire jQuery chain to make it look better and play nice with
other jQuery stuff, but I'm hoping Cody might want to add some of this
into Thickbox.

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


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

Reply via email to