Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-10-2010, 07:55 AM   PM User | #1
marilynn.fowler
Regular Coder

 
Join Date: Aug 2002
Location: San Francisco
Posts: 442
Thanks: 19
Thanked 15 Times in 15 Posts
marilynn.fowler is an unknown quantity at this point
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
marilynn.fowler is offline   Reply With Quote
Old 11-13-2010, 02:48 AM   PM User | #2
marilynn.fowler
Regular Coder

 
Join Date: Aug 2002
Location: San Francisco
Posts: 442
Thanks: 19
Thanked 15 Times in 15 Posts
marilynn.fowler is an unknown quantity at this point
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
marilynn.fowler is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:53 AM.


Advertisement
Log in to turn off these ads.