1

I've got colorbox set up and working great, but I'd just like to do one little thing that I can't figure out. I want to have a colorbox gallery of, for example, a dozen photos, but select three to display on the page. Once you click one of the three photos on the page, it opens up the colorbox, which allows you to click through all 12 photos. Is this possible with Colorbox and Drupal 7?

EDIT: I'd like this to be a fix that I can use on a lot of different pages with varying numbers of photos. Sorry for the ambiguity.

0

Create a custom template page. Display the first 3 images - wrap the remaining images in a div that you hide, with css eg: display: none; or add a hide class to them - attach the gallery_class class to them all so you can call them using

$(".gallery_class").colorbox({rel:'gallery_class'});
2
  • That makes sense, but I want a fix that will work on a bunch of pages. Sorry I didn't make that clear. I have about 50 pages that each have a dozen photos. How can I make this work for all those pages? Nov 15 '11 at 15:56
  • Hi again. This will work on a bunch of pages. If you use the file field with unlimited values you can tell it to simply show the first 3 as they have been sorted in the node edit page. So you create a template for that content type - hard code the 3 images into it with file checks etc (incase you only have 2 or even 1) - do a loop and output the rest of the images with a hidden class and gallery class and then call the colorbox slideshow ...
    – tecjam
    Nov 15 '11 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.