Results 1 to 7 of 7

Thread: Make Lytebox loop image sets?

  1. #1
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Make Lytebox loop image sets?

    Hi. Is there a way to make Lytebox loop image sets? So that when I reach the last image, the next click goes back to the first one.

    Really miss this feature ... Can anyone help?

  2. #2
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    bump ..
    Last edited by mustang4ever; 11-22-2009 at 11:15 PM.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    See:

    http://www.dynamicdrive.com/forums/s...588#post208588

    Make sure to read the entire thread, as the solution evolved a bit becoming more complete.

    If you have any questions though, please respond here.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi John. I've read your solution in the other thread, but it's for slideshows. I presume it wouldn't work with slideshow option switched off, no?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's right. Add this highlighted property (near the beginning of lytebox.js):

    Code:
    function LyteBox() {
    	/*** Start Global Configuration ***/
    		this.theme			= 'grey';	// themes: grey (default), red, green, blue, gold
    		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden
    		this.outerBorder		= true;		// controls whether to show the outer grey (or theme) border
    		this.resizeSpeed		= 8;		// controls the speed of the image resizing (1=slowest and 10=fastest)
    		this.maxOpacity			= 80;		// higher opacity = darker overlay, lower opacity = lighter overlay
    		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
    		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions
    		this.doAnimations		= true;		// controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.
    		this.loopImages			= true;		// should images loop with "Prev/Next" buttons
    		this.borderSize			= 12;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
    	/*** End Global Configuration ***/
    	
    	/*** Configure Slideshow Options ***/
    		this.slideInterval		= 4000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
    		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide
    		this.showClose			= true;		// true to display the Close button, false to hide
    		this.showDetails		= true;		// true to display image details (caption, count), false to hide
    		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide
    		this.autoEnd			= false;	// true to automatically close Lytebox after the last image is reached, false to keep open
    		this.pauseOnNextClick		= false;	// true to pause the slideshow when the "Next" button is clicked
            	this.pauseOnPrevClick 		= true;		// true to pause the slideshow when the "Prev" button is clicked
    	/*** End Slideshow Configuration ***/
    Go to the LyteBox.prototype.updateNav function and find this section (the section begins around line 531 in the lytebox.js file) and add/change the highlighted:

    Code:
    		if(this.activeImage != 0 || this.loopImages) {
    			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev')),
    			numPrev = this.activeImage <= 0?  this.imageArray.length - this.activeImage : this.activeImage;
    				object.style.display = '';
    				object.onclick = function() {
    					myLytebox.changeContent(numPrev - 1); return false;
    				}
    		} else {
    			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
    		}
    		if(this.activeImage != (this.imageArray.length - 1) || this.loopImages) {
    			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext')),
    			numNext = this.activeImage >= this.imageArray.length - 1? this.activeImage - this.imageArray.length : this.activeImage;
    				object.style.display = '';
    				object.onclick = function() {
    					myLytebox.changeContent(numNext + 1); return false;
    				}
    Be sure not to miss the added commas on the two previous lines where they're added. If you have problems, revert that section, and simply copy over the above code in place of:

    Code:
    		if(this.activeImage != 0) {
    			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
    				object.style.display = '';
    				object.onclick = function() {
    					myLytebox.changeContent(myLytebox.activeImage - 1); return false;
    				}
    		} else {
    			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
    		}
    		if(this.activeImage != (this.imageArray.length - 1)) {
    			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
    				object.style.display = '';
    				object.onclick = function() {
    					myLytebox.changeContent(myLytebox.activeImage + 1); return false;
    				}
    from the original.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. The Following User Says Thank You to jscheuer1 For This Useful Post:

    mustang4ever (12-13-2009)

  7. #6
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up

    Wow, so little change was needed!
    Thanks a lot, man. You rock!

  8. #7
    Join Date
    Jul 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Make Lytebox loop image sets? Need heelp

    Hello, I'm conscious this is a really older post, but I'm trying to do the changes you say in this post, and it doesn't work properly, I think it's because I have a different lytebox version installed.
    I've installed the 5.5 version, is it possible to do it? It would be great to me!

    Thanks a lot!

    I attach you my lytebox.js to see where's the problem.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •