From what information you supply I can see that you are using the feature of PrettyPhoto that allows for a group of images to be seen. The original question only asked if individual images could be shown. If you want to preserve the original order of the images, you have to copy them in that order and use those, not the ones that show in the pagination 'pages'. The ones in the 'pages' must be able to trigger the ones in the original order though.
So you would do something like, on document ready copy (clone) all the links in the group to a hidden div at the beginning of the page, remove the rel from the links in the 'pages' and replace it with a class. Then initialize the hidden links to PrettyPhoto. Then add a live() or on() event (which depends upon the version of jQuery you're using) to the document, something like (requires jQuery 1.7 or later):
Code:
jQuery(function($){
var $origorder = $('<div></div>').css({visibility: 'hidden', position: 'absolute', top: -10000, left: -10000}).prependTo('body'),
$ppas = $("a[rel^='prettyPhoto']");
$ppas.each(function(i, a){
var $ppa = $ppas[i];
$ppa.clone(true).appendTo($origorder);
a.removeAttribute('rel');
$ppa.addClass('prettyphotoproxy');
});
$ppas = $("a[rel^='prettyPhoto']");
$ppas.prettyPhoto();
$(document).on('click', '.prettyphotoproxy', function(e){
var href = this.href;
$ppas.each(function(i, a){
if(a.href === href){
$ppas[i].trigger('click');
e.preventDefault();
return false;
}
});
});
});
Since I cannot know what your setup is like, I would have to make my own demo up from scratch and hope that it was close enough to what you're doing to work for it and to even just to test my code for syntax, basic workability. That's a waste of my time. If I could see your page, I could use developer tools to determine a good way to copy the links and activate them as I describe. What I just wrote in the above code block might work 'as is' though, so try it. And get rid of the highlighted line in the callback:
Code:
/**
* Callback function that displays the content.
*
* Gets called every time the user clicks on a pagination link.
*
* @param {int} page_index New Page index
* @param {jQuery} jq the container with the pagination links as a jQuery object
*/
function pageselectCallback(page_index, jq){
var new_content = jQuery('#hiddenresult div.result:eq('+page_index+')').clone();
$('#Searchresult').empty().append(new_content);
$("a[rel^='prettyPhoto']").prettyPhoto();
return false;
}
The browser cache may need to be cleared and/or the page refreshed to see changes.
If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
Bookmarks