View Full Version : Problem with Lighbox on a Dynamic AJAX Content Page

09-15-2008, 06:59 AM
1) Script Title: Dynamic AJAX Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem:

I have designed my page to load all pages using Dynamic AJAX Content Script. All works fine, thanks to the uploader!

But got in totrouble just lately, I need to use Lightbox on one of the AJAX page. The Lighbox run as intended when running the page alone but won't work when called using Dynamic AJAX Content script.

I got the Lighbox script from this link... http://www.digitalia.be/software/slimbox

What will I do? Please Help.

09-16-2008, 12:09 AM
Anyone Please?

09-16-2008, 11:37 AM
Slimbox isn't a DD script. However lightbox is. It's most recent version (though it has a correctable problem with duplicate images in groups) will work well in an AJAX environment:


Just add the script to your 'top' page and place the lightbox links on the top page and/or on the imported page(s). Paths to images (and anything else) on the imported page must be either absolute, or if relative, relative to the top page.

If you need more help:

Please post a link to the page on your site that contains the problematic code so we can check it out.

09-17-2008, 02:51 AM
Thanks a lot John!

I've used lightbox instead as suggested and I followed the instructions you have provided for configuring lightbox on other threads here in DD.

Thanks again!

09-17-2008, 03:30 AM
I have the exact same problem! I'm using the ajax dynamic content and the pages being pulled in have images in them where they have the rel="lightbox" (or rel="facebox", tried both). In my case, though, it works just the first time you summon the lightbox effect then it won't work on any of the other pages summoned. I have a post on this already:


Need some ideas on this one. Thanks!

09-18-2008, 06:14 AM
@ John
So far my site works perfectly for Lightbox 2.04 on Dynamic AJAX page, my problem now is I need to show texts so I resort on using GreyBox (http://www.orangoo.com/labs/GreyBox/), but the problem is again it won't work on Dynamic AJAX page. If only I can load texts in Lightbox.

Here's the link to the test site. MY SITE (http://onyxwebwizards.com/fra/index1.html).
All of the sub pages are loaded using Dynamic AJAX Page, on the Home page click on the first property image or the banner on the left side. On the resulting Properties page, clicking the image will activate Lightbox and clicking the the texts will activate Greybox. Clicking this from the index page will not work, but will work directly on this link: DIRECT LINK (http://onyxwebwizards.com/fra/content.html).

@ simcomedia
Try looking at my codes, this might help you. I've ran into the trouble before as posted earlier, I just followed jscheuer1's instructions on other threads.

09-18-2008, 06:35 AM
Just by way of explanation, the reason why lightbox 2.04 works with AJAX loaded content is that instead of initializing each link (old method) that has a rel="lightbox" attribute to perform as a part of the script by giving it an onclick event, it gives the entire window an onclick event. Whenever the page in the window is clicked, this event checks to see if a lightbox link was clicked, if so - it launches the lightbox viewer. That way you can load in new lightbox links at any time, instead of the old way, where they either had to already be on the page when the onload event fired, or be initialized after they were added.

I'm not up on Greybox. But I just tried their demo site though, and none of the examples I tried worked, and there were errors. I tried in several browsers, none worked.

So I'm pretty sure that if it won't work on their site without AJAX, it won't work on your site with AJAX.

I tried your test pages, and they seemed to work - sort of. But that's lightbox working, not Greybox. The two scripts (even if Greybox worked at all) should probably not be combined on one page.

Now, I'm not sure what you mean by needing text. Lightbox can display captions. Isn't that enough?

09-18-2008, 08:01 AM
Hi John,

Thanks for the reply, I understand your not up on Greybox.

I really love Lightbox's effect on the user experience and it's painless implementation,
what I'm trying to achieve though is a pop-up page that can hold texts/page with the same effect as Lightbox does. Much like this one...


Caption on the Lightbox images are good, but there should always be an images to put a text and the control for the text are limited.

Thanks, I appreciate your help.


09-18-2008, 08:18 AM
Ok got it working finally after posting a question on their site.

It also has the advance function just like the Lightbox does, you just need to use that code disabled by default.

To answer why I used the two, let's just say I want to get the best of both worlds!

I just wish Lightbox will support loading page in the coming days...

Thanks a lot for everything!!!