I have a photo gallery that is displayed using a view. Since there can be 100+ images per gallery it is usually paged. When the user clicks on an image it opens in a Colorbox, but the user can only use the back and forward buttons to access the 20 nodes on the current page of the view. To view the rest you would have to close the Colorbox, click next on the pager of the view and then click a photo to open the Colorbox again. Quite a hassle in other words.
Is there currently any way to tell Colorbox Node to use all the nodes from the view, not just those displayed on the current page of the view? If not, do you have any hints on how to go about to try implementing such a feature?
Thanks for an awesome module!
Comments
Comment #1
AndersEkman commentedComment #2
iLLin commentedThe initial issue is that colorbox is a javascript library, meaning it queues off the rendered content. Since 20 photos are rendered, it only knows about those 20 and therefore the remaining paged items are missed. There is no way around that.
Possible Solution
Create the same view for your photos, and instead of showing 20 paged, show 1 paged and then link all your photos to that views page and then style your views ajax pager to look colorbox-ish (new word). Your only issue now is determining which page should the colorbox auto open to, doing some PHP to determine the position of the pager and automatically adding the ?page parameter to the colorbox view. (Might not be the best solution)
Another idea, is to output all the URLs into some type of JS array and then use that array to iterate through the links. You will need to write this functionality.
I have used this module with some success: https://www.drupal.org/project/prev_next. I had to use PHP in the contextual filter to get it to work correctly.
You can write a custom module that has your own MODULE_prev_next_nid(); where you can return out node ids based on your original views display so it matches.
Regardless, it will be custom.
Comment #3
AndersEkman commentedThanks for the quick reply and for the pointers! I'll get to work and see what I can do. In case I am succesfull I will report back here to explain the solution.
And again - great module!
Comment #4
iLLin commented