Jump to content

Javascript in AJAX Content


Liquid Fire

Recommended Posts

I think this is where this question should go becuase it is mainly a javascript questyion.

 

I have a lightbox(slimbox) to show a image gallery. when i load the page it works fine.  when I laod the smae page with ajax it does not work.  is there a problem with doing javascript in ajax loading content?

Link to comment
https://forums.phpfreaks.com/topic/57025-javascript-in-ajax-content/
Share on other sites

The problem is the lightboxes out there only look at the HTML code when the page loads, so if you using AJAX to load the page, the lightbox won't know it has to look for the links, therefore not working. To fix that, look at your lightbox script and find the initiating function and find what events the script add to the links. You can call that function when the AJAX page loads as well.

yea, I found a modified version of the lightbox that has the lightbox as a class so you can add content to it on the fly, this might work for me but i have to try it to see if it does and if not I will take a look at the code to see if i can add links somehow.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.