How to Open Shadowbox inside a target element

3 messages Options
Embed this post
Permalink
mdodge

How to Open Shadowbox inside a target element

Reply Threaded More More options
Print post
Permalink
Here's a little bit of tweaking that allows you open your shadowbox inside a specific target element instead of filling the browser window. I haven't got any specific need for this (yet) but have seen a number of other lightbox-esquq scripts do this, and since it is a 3 line edit, I thought it was worth it:

1: Add 'container: false' as a default option in shadowbox.js (line 157)
2: Change line 692 to the following:

    var el = S.options.container?S.util.get(S.options.container):document.body; S.lib.append(el, markup);

3: When setting up Shadowbox, include the following setting:

    Shadowbox.options.container = 'target_element_id';

One note is that the target element should have position:relative or position:absolute, and a specified width/height, but that pretty much goes without saying.
julou

Re: How to Open Shadowbox inside a target element

Reply Threaded More More options
Print post
Permalink
Very nice… And exactly what I was trying to do in a previous post.

Any idea about doing this with SB2? Actually, I'm using SB within drupal, SB3 is not implemented yet!
Thank you in advance,

Thomas
fcyron

Re: How to Open Shadowbox inside a target element

Reply Threaded More More options
Print post
Permalink
In reply to this post by mdodge
Hi,

could we please have an example? I don't get it working...

Thanks,
Falk