...

View Full Version : open page to a specific slide from another page



marilynn.fowler
11-10-2010, 07:55 AM
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:


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);
}

marilynn.fowler
11-13-2010, 02:48 AM
In answering a cookie question, Logic Ali gave me the answer to this question. Hurrah.

http://www.codingforums.com/showthread.php?t=209103



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum