After you load the second page of images, you have to execute the prettyPhoto javascript "$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_square'});" again. This will attach the prettyPhoto functionality to the new images you loaded in the page. If you didn't do that, when you clicked on the images, they will just open the larger size.
HOWEVER, there is a small bug in prettyPhoto 2.5.5 and 2.5.6 relating to this functionality.
If you are using 2.5.5, here is the fix:
http://forums.no-margin-for-errors.com/comments.php?DiscussionID=211
If you are using prettyPhoto 2.5.6, here is the fix:
http://forums.no-margin-for-errors.com/comments.php?DiscussionID=323&page=1
Hi folks!
I ran into the same problem, I'm calling new elements via an AJAX call..
So, consider you've got your response from the php file with all the elements in the' xmlHttp.responseText' variable, after appending/inserting the fetched data into the '' element, place this code...
document.getElementById('ulID').innerHTML = xmlHttp.responseText; //Modifying the elements with the new ones..
$(".ppt").remove();
$(".pp_overlay").remove();
$(".pp_pic_holder").remove();
$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'light_square'}); // binding the new elements!