Results 1 to 3 of 3

Thread: Lightbox continous loop help

  1. #1
    Join Date
    Jun 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Lightbox continous loop help

    Hi,

    Just wondering if I can get some help with making a minor change to lightbox.

    I want the images shown to be navigated in a loop instead of stopping at the last image, and to be able to go backwards from the beginning as well.

    Im using a modified version of lightbox (attached) that is designed to work with a flash carousel.

    I've seen this done in other scripts, but unfortunately I need to use this particular flavor of lightbox to get it working.

    Any help would be appreciated, fyi, i found this old post

    http://www.dynamicdrive.com/forums/a...p/t-25681.html

    and tried it, but didnt get any result.

    Thanks

  2. #2
    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

    Starting at line #585 in the attached file you supply we find this function:

    Code:
    	//
    	//	updateNav()
    	//	Display appropriate previous and next hover navigation.
    	//
    	updateNav: function() {
    
    		Element.show('hoverNav');				
    
    		// If not first image in set, display prev image button
    		if(activeElement != 0){
    			Element.show('prevLink');
    			document.getElementById('prevLink').onclick = function() {
    				myLightbox.changeElement(activeElement - 1); return false;
    			}
    		}
    
    		// If not last image in set, display next image button
    		if(activeElement != (elementArray.length - 1)){
    			Element.show('nextLink');
    			document.getElementById('nextLink').onclick = function() {
    				myLightbox.changeElement(activeElement + 1); return false;
    			}
    		}
    		
    		this.enableKeyboardNav();
    	},
    Replace it with this one:

    Code:
    	//
    	//	updateNav()
    	//	Display appropriate previous and next hover navigation.
    	//
    	updateNav: function() {
    
    		Element.show('hoverNav');				
    
    	// Display prev image button
    		Element.show('prevLink');
    		document.getElementById('prevLink').onclick = function() {
    			var prev = activeElement != 0? activeElement - 1 : elementArray.length - 1;
    			myLightbox.changeElement(prev); return false;
    		}
    
    	// Display next image button
    		Element.show('nextLink');
    		document.getElementById('nextLink').onclick = function() {
    			var next = activeElement != (elementArray.length - 1)? activeElement + 1 : 0;
    			myLightbox.changeElement(next); return false;
    		}
    		
    		this.enableKeyboardNav();
    	},
    - John
    ________________________

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

  3. #3
    Join Date
    Jun 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thankyou very much John, worked like a charm!

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
  •