PrettyPhoto content and Ajax-loaded
I am currently working on a small product display page that loads a prettyPhoto gallery with ajax support. The problem is prettyPhoto doesn't work with images added after the page has loaded. I understand that I need to reinitialize prettyPhoto after loading new content, but how? I tried adding prettyPhoto.init (); to the code that returns to the page - it doesn't work.
The page I'm working here: http://turningpointpro.com/page.php?id=10
+2
source to share
3 answers
I ended up finding two solutions. The first and best was to put all this bit:
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto();
});
in the ajax callback, not in the function prettyPhoto.init();
I called earlier.
I also had some luck using the API instead of reloading prettyPhoto again.
Hope this helps someone.
+5
source to share