Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    455
    Thanks
    19
    Thanked 15 Times in 15 Posts

    open page to a specific slide from another page

    I have a slideshow on the "Projects" page. The javascript is external.
    There's a link on the homepage that when clicked needs to open the Projects page with the appropriate slide loaded. How do I do that?

    Here's the code I have for the slideshow:

    Code:
    var prev = document.getElementById('prev');
    var next = document.getElementById('next');
    var current = 0;
    
    function prevPic() {
    	clearInterval(interval);
    
    	if(current > 0) {
    		current--;
    		
    		if(current == 0) {
    			document.getElementById('next').src = "images/right_arrow.jpg";
    			document.getElementById('prev').src = "images/left_arrow_off.jpg";
    		} else {
    			document.getElementById('next').src = "images/right_arrow.jpg";
    			document.getElementById('prev').src = "images/left_arrow.jpg";			
    		}
    		update();
    	}		
    }
    
    function nextPic() {
    	clearInterval(interval);
    
    	if(current <  slides.length - 1) {
    		current++;
    		
    		if(current == slides.length - 1) {
    			document.getElementById('next').src = "images/right_arrow_off.jpg";
    			document.getElementById('prev').src = "images/left_arrow.jpg";
    		} else {
    			document.getElementById('next').src = "images/right_arrow.jpg";
    			document.getElementById('prev').src = "images/left_arrow.jpg";			
    		}
    		update();
    	}
    }
    
    function update() {
    	var pic = slides[current];
    	document.getElementById('project_title').innerHTML = pic.title;
    	document.getElementById('project_image').src = "images/slides/" + pic.image;
    	document.getElementById('project_location').innerHTML = "<span>Location:</span> " + pic.location;
    	document.getElementById('project_operation').innerHTML = "<span>Commercial Operation:</span> " + pic.commercial_operation;
    	document.getElementById('counter').innerHTML = (current + 1) + " of " + slides.length;
    	
    	if(pic.link) {
    		document.getElementById('project_link').style.display = "block";
    		document.getElementById('project_href').href = pic.link;
    	} else {
    		document.getElementById('project_link').style.display = "none";		
    	}
    }
    
    //preload slides
    var images = [];
    
    for(i in slides) {
    	var img = new Image();
    	img.src = "images/slides/" + slides[i].image;
    	images.push(img);
    }
    Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. Groucho Marx

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    San Francisco
    Posts
    455
    Thanks
    19
    Thanked 15 Times in 15 Posts
    In answering a cookie question, Logic Ali gave me the answer to this question. Hurrah.

    http://www.codingforums.com/showthread.php?t=209103
    Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read. Groucho Marx


  •  

    Posting Permissions

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