How to code "Next" & "Previous" links for colorbox?

I've set up colorbox to work with a slightly modified default theme. Instead of the image thumbnails linking to image.php, they link directly to the full-sized image which is displayed by colorbox.

While I'm comfortable with HTML and CSS, I only know enough PHP at this point to switch/replace functions, do simple navbars, etc. Gradually learning.

What I want to do here is have Colorbox include "Next" and "Previous" links or buttons linking to the corresponding image in sequence. Can see how 'getNextImageURL' works in image.php and also see the "rel" key on the Colorbox website, but am not sure how to make those work together. Can anyone point me in the right direction on this?

Comments

  • acrylian Administrator, Developer
    Colorbox by default opens an image directly so you can't use the functions like "getNextImageURL()" with it. In our case that is the full images within the root "albums" folder in the zenpage theme for example.

    You probably can of course change the theme to open the cached image, too. The only way to get prev/next within Colorbox is to use the gallery mode using the "rel" you see. How to do that is explained on the Colorbox site. THe change to do this would have to happen on the theme's album.php. See the theming tutorial about that.
  • "I've set up colorbox to work with a slightly modified default theme. Instead of the image thumbnails linking to image.php, they link directly to the full-sized image which is displayed by colorbox."

    This is what I'm trying to do with a custom Zenpage theme, but not quite sure where to look/edit.
  • acrylian Administrator, Developer
    You have to define colorbox to do so by adding a `rel`attribute to every image link.
    http://www.jacklmoore.com/colorbox/
    You will have to modify the `next_image` loop on your theme with that and also change the link to the image itself. This will only enable you to go through the images on that page, not on further pages if you have more naturally (as colorbox does not know them). To do so you have to list all images on one page or list those of further pages hidden. The Slideshow plugins have a colorbox mode that does this.
Sign In or Register to comment.