I've installed lightbox and it's working like a charm, but I fear people may not know to hover over the photo(they are on the small side) to progress to the next image in a series.

Is there an easy way to add a next/prev link after where it says image x of x?

Thanks much

Comments

stella’s picture

Assigned: Unassigned » stella
Category: feature » support

It's not a feature I will be adding to the lightbox2 module, but here is how you can implement it for your site. The code below doesn't disable the hover "Prev" or "Next" links though, it just adds textual prev and next links to the bottom of the image info box.

In lightbox2/js/lightbox.js, change line 497 from:

Element.setInnerHTML( 'numberDisplay', "Image " + eval(activeImage + 1) + " of " + imageArray.length);

to:

   // Element.setInnerHTML( 'numberDisplay', "Image " + eval(activeImage + 1) + " of " + imageArray.length);
   myPrevLink = '<a href="#" id="myPrevLink">[Prev]</a>';   
   myNextLink = '<a href="#" id="myNextLink">[Next]</a>';
   Element.setInnerHTML( 'numberDisplay', "Image " + eval(activeImage + 1) + " of " + imageArray.length + "<br />" + myPrevLink + " " + myNextLink);
   document.getElementById('myPrevLink').onclick = function() {
    myLightbox.changeImage(activeImage - 1); return false;
   }
   document.getElementById('myNextLink').onclick = function() {
    myLightbox.changeImage(activeImage + 1); return false;
   }

Cheers,
Stella

stella’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)
openbox’s picture

Version: 5.x-1.x-dev » 5.x-2.1
Status: Closed (fixed) » Active

What's the fix now with the code change to 5.x-2? It would be nice if these was an option to choose text links in addition to hovering over the image for links.

stella’s picture

Status: Active » Fixed

I think the same code snippet should work, just drop the "my" from in front of "myLightbox". Perhaps try out the new dev version (it is stable). It allows you to force the navigation links to always appear (not just on hover) and provides an alternative lightbox layout.

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

walden’s picture

Status: Closed (fixed) » Active

Hi Stella, thanks for your help + support to date.

I've downloaded the 5.x-2.x-dev version of lightbox so that I wouldn't have to hack the module to get the next/previous links to show up. However, the "force visibility" box is checked and they aren't showing up.

My test page is here: http://216.146.194.48/guide/architects/ahearn-schopfer-associates

Any ideas?

Thanks!

stella’s picture

Hi,

From looking at your lightbox2/css/lightbox.css I can see that you are still using the old version. It doesn't match that which is in the dev version or CVS. Perhaps you forgot to update this file when upgrading the module?

Cheers,
Stella

walden’s picture

Hi Stella - I tried using the new one, but didn't have an luck, so I switched back to the old one as it was customized. I've brought my customizations over to the new css file, and it's live now. [the customizations suffices only to turn the text black).

Any other thoughts?

Thanks again.

stella’s picture

I've just tried out your website again and after clearing the cache, the navigation links are always visible now, not just on hover. Please clear you cache and try it again.

Stella

walden’s picture

Hi I see what you mean. I was referring (perhaps mistakenly) to navigation links which appear next to [image 1 of 5]. They would say prev or next - is this not part of the module?

Thanks again, Fletcher

stella’s picture

The images were changed to support multi-lingual sites. However the old textual prev and next images are still included in the distribution. They're in the lightbox2/images/ directory with the file names "prevlabel.gif" and "nextlabel.gif". You can alter the lightbox.css (or lightbox_alt.css) file to change which image is used. You may need to tweak the positionings however. This was mentioned in the release notes for 5.x-2.1.

Cheers,
Stella

walden’s picture

cool thanks, I should have checked it out the notes.

Thanks again!

stella’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.