PDA

View Full Version : Lightbox Viewer from 2 different Hyperlinks ??



whitewolf
12-22-2006, 05:40 PM
Script: Lightbox Image Viewer 2.0
http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm

Hello,

Could you please help me with the following problem:

I would like to link to the Lightbox Viewer from 2 different hyperlinks on the same page.

On my gallery page, I have a Thumbnail image which is hyperlinked to open the Lightbox viewer, and I would also like to have Text in my menu hyperlink to the same viewer.

Problem is, I linked both the thumbnail and the text to open the same first image of the gallery, and the viewer displayed the first image TWICE. Once at the beginning of the gallery and once at the end.

Is it possible to have one of the links just point to a gallery, or make it image-less?

Thanks,
Allan

whitewolf
12-24-2006, 05:55 PM
C'mon guys, anyone, please ?

jscheuer1
12-29-2006, 05:49 AM
Without seeing your page I cannot be sure if this will do it but, from the looks of what you are describing it will. It has helped get rid of duplicate images in other non-standard lightbox 2.0 implementations. OK, look for this in the lightbox.js file (around line 118):


// -----------------------------------------------------------------------------------

//
// Extending built-in Array object
// - array.removeDuplicates()
// - array.empty()
//
Array.prototype.removeDuplicates = function () {
for(i = 1; i < this.length; i++){
if(this[i][0] == this[i-1][0]){
this.splice(i,1);
}
}
}

Change it to this:


// -----------------------------------------------------------------------------------

//
// Extending built-in Array object
// - array.removeDuplicates()
// - array.empty()
//
Array.prototype.removeDuplicates = function () {
for(i = 0; i < this.length; i++){
for (var i_tem = 0; i_tem < this.length; i_tem++)
if(this[i][0] == this[i_tem][0]&&i!==i_tem){
this.splice(i_tem,1);
}
}
}

If this doesn't work for you, perhaps you are linking to two identical image files with different names or there could be another problem.

whitewolf
12-29-2006, 08:35 AM
John,

Thank you so much, it's solved the problem.

Here's a link to the gallery in question, please visit the museum:

http://www.allanmoon.com/gallery.html

DYNAMIC DRIVE forum rules !

Thanks again,
Allan

:D