PDA

View Full Version : FrogJS Image Gallery - code for continuous loop?



pigling
12-03-2007, 04:33 AM
1) Script Title: FrogJS Image Gallery

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/frogjs/index.htm

3) Describe problem: does anyone know the code to have this gallery go around in a continuous loop rather than stop at the end and have to go back though in the other direction as it presently does. Cheers

jscheuer1
12-03-2007, 09:04 AM
Make the following addtions (red):


. . . Thumb2.style.left = '0';
ribbit.appendChild(lThumb2);
//-----------------------------------------
// End Inserting new elements
//-----------------------------------------

// Preloads first image and displays image along with next thumbnail
var myFrog = this; // IE can't use the global `myFrog` until it's been initialized
var imgPreloader = new Image();
imgPreloader.onload=function(){
myFrog.loadMainImage(0, imgPreloader.width);
myFrog.thumbIn(1, 'right');
myFrog.thumbIn(imageArray.length-1, 'left');
}
imgPreloader.src = imageArray[0]['full'];
},

These four all add the same line of code in four different spots:


// thumbIn()
// Loads in new thumbnail and preloads image if neccessary
thumbIn: function(imageNum, side){
Element.hide('FrogJS'+side+'Thumb1');
var imageNum=imageArray[imageNum]? imageNum : imageNum < 0? imageArray.length+imageNum : imageNum-imageArray.length;
if(imageArray[imageNum]){
Element.setCur . . .


// thumbOut()
// Removes old thumbnail
thumbOut: function(imageNum, side){
var imageNum=imageArray[imageNum]? imageNum : imageNum < 0? imageArray.length+imageNum : imageNum-imageArray.length;
if(imageArray[imageNum]){
$('FrogJS'+sid . . .


// mainIn()
// Fades thumbnail into main image
mainIn: function(imageNum, side){
var imageNum=imageArray[imageNum]? imageNum : imageNum < 0? imageArray.length+imageNum : imageNum-imageArray.length;
$('FrogJS'+side+'Thumb2').src = imageArray[imageNum]['thumb'];
Element.removeDime . . .


// mainOut()
// Fades old main image into thumbnail
mainOut: function(imageNum, side){
Element.hide('FrogJS'+side+'Thumb1');
var imageNum=imageArray[imageNum]? imageNum : imageNum < 0? imageArray.length+imageNum : imageNum-imageArray.length;
if(imageArray[imageNum]){
Element.setC . . .

This might be a little bit of overkill, but worked in testing.

pigling
12-03-2007, 08:08 PM
Awesome, thanks John that works beautifully.

metblack85
02-26-2009, 02:45 PM
Does anyone have any idea on how to accomplish the same thing with the CMotion gallery?

Thanks

jscheuer1
02-27-2009, 12:14 AM
Please post a new thread for a new question.