473,507 Members | 2,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to link to specific images in a Javascript slideshow

I have a popup window which is a slideshow of about 7 images. When the
popup window loads, the first image is present and then the viewer can
select next or previous to scroll through the rest of the images.

I'd like to use the same popup window at different points throughout
the website and have the Virtual Tour (slideshow) open up at the
appropriate photos. Meaning I'd like to control which picture the
popup window opens up to, depending on where the user is in the site.

Does anyone know where I can find code that does this? I am somewhat
familiar with Javascript but would like to find some ready-made code
which accomplishes this.

Thanks for all help and suggestions!!

--JAG
Jul 23 '05 #1
2 2086
Jeannie wrote:
I have a popup window which is a slideshow of about 7 images. When the
popup window loads, the first image is present and then the viewer can
select next or previous to scroll through the rest of the images.

I'd like to use the same popup window at different points throughout
the website and have the Virtual Tour (slideshow) open up at the
appropriate photos. Meaning I'd like to control which picture the
popup window opens up to, depending on where the user is in the site.

Does anyone know where I can find code that does this? I am somewhat
familiar with Javascript but would like to find some ready-made code
which accomplishes this.

Thanks for all help and suggestions!!

--JAG


I don't know about ready made code - however it shouldn't prove to
difficult to come up with some sort of a solution since you already have
some javascript skills. There are a couple of things you might already
know, but you've not connected them...

First, when you open your popup window with window.open, you give the
popup window a name... If you use the same window name as a target in
any of your other pages, it will update the popup window - And if its
not already open (perhaps the user closed it) then a new one will open.

The only problem that I could forsee is that you might want a popup that
is larger then the one opened in an earlier window in which case you
might have to resize it (which I believe is possible on most recent
popular browsers but I've never written code for it).

Does that help you any, or do you still need some code? In my early days
of learning javascript I used to examine some of the code at
javascript.internet.com however not all of it is environmentally
friendly (in such that it may be unclean code, achieveing results that
could be achieved with less resources using alternative methods).
Still, its helps me along... maybe you might find what you're looking
for there.

randelld
Jul 23 '05 #2
Thanks - though I wasn't able to quite come up with a solution yet. I
am putting my code here, maybe that will help. If anyone can make
suggestions on how to alter it, that would be much appreciated!

Here's the code for the popup slideshow I have now which currently is
running.
***********************************************
<html>
<head>
<script language="JavaScript">
<!--
var interval = 30000;
var random_display = 0;
var imageDir = "images/";

var imageNum = 0;
imageArray = new Array();
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_airplane.jpg");
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_airplane.jpg");
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_humidor.jpg");
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_humidor2.jpg");
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_lounge1.jpg");
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_lounge2.jpg");
imageArray[imageNum++] = new imageItem(imageDir + "im_pop_udr.jpg");
imageArray[imageNum++] = new imageItem(imageDir +
"im_pop_winecel.jpg");

var totalImages = imageArray.length;

function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}

function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
if (random_display) {
imageNum = randNum(0, totalImages-1);
}
else {
imageNum = (imageNum+1) % totalImages;
}

var new_image = get_ImageItemLocation(imageArray[imageNum]);
return(new_image);
}

function getPrevImage() {
imageNum = (imageNum-1) % totalImages;
var new_image = get_ImageItemLocation(imageArray[imageNum]);
return(new_image);
}

function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;
}

function switchImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "switchImage('"+place+"')";
timerID = setTimeout(recur_call, interval);
}
// -->
</script>
</head>
<body>
<table>
<tr>
<td><img src="images/im_pop_airplane.jpg" width="442" height="288"
alt="" border="0" img name="slideImg"></td>
</tr>
<tr>
<td class="closelink"><a href="#" onClick="prevImage('slideImg');
clearTimeout(timerID)" class="closelink"> &lt;&lt;previous</a> </td>
<td></td>
<td align="right" class="closelink"><a href="#"
onClick="switchImage('slideImg'); clearTimeout(timerID)"
class="closelink">next&gt;&gt; </a></td>
</tr>
<tr>
</table>
</body>
</html>
************************************************** *********

The code above is the actual slideshow code which runs in a popup
window. I want to be able to call up the slideshow popup from other
pages in my website, but have it start at an image I specify.

For instance, on one page, I use this code to call up the slideshow
popup:
<a href="javascript:popUp('banquet_tour.html')"><img
src="images/bt_bd_pic2.jpg" width="234" height="153" alt=""
border="0"></a>

It always defaults to the first popup in the array. How can I ask it
to start with a different specific image in the array?
***********************************************

Reply Via Newsgroup <re****************@please.com> wrote in message news:<LpJdc.63527$oR5.13701@pd7tw3no>...
Jeannie wrote:
I have a popup window which is a slideshow of about 7 images. When the
popup window loads, the first image is present and then the viewer can
select next or previous to scroll through the rest of the images.

I'd like to use the same popup window at different points throughout
the website and have the Virtual Tour (slideshow) open up at the
appropriate photos. Meaning I'd like to control which picture the
popup window opens up to, depending on where the user is in the site.

Does anyone know where I can find code that does this? I am somewhat
familiar with Javascript but would like to find some ready-made code
which accomplishes this.

Thanks for all help and suggestions!!

--JAG


I don't know about ready made code - however it shouldn't prove to
difficult to come up with some sort of a solution since you already have
some javascript skills. There are a couple of things you might already
know, but you've not connected them...

First, when you open your popup window with window.open, you give the
popup window a name... If you use the same window name as a target in
any of your other pages, it will update the popup window - And if its
not already open (perhaps the user closed it) then a new one will open.

The only problem that I could forsee is that you might want a popup that
is larger then the one opened in an earlier window in which case you
might have to resize it (which I believe is possible on most recent
popular browsers but I've never written code for it).

Does that help you any, or do you still need some code? In my early days
of learning javascript I used to examine some of the code at
javascript.internet.com however not all of it is environmentally
friendly (in such that it may be unclean code, achieveing results that
could be achieved with less resources using alternative methods).
Still, its helps me along... maybe you might find what you're looking
for there.

randelld

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1603
by: Raphael Gluck | last post by:
Hi everyone I am not pretty well versed with javascript, and i am sure many you see questions like these every day. But I am looking for a simple javascript, that stores a few images, and...
1
1868
by: charliewest | last post by:
I am trying use server controls or web controls to simulate the following behavior. I've an image wrapped w/in a link to create a rollover effect as if both elements we're one graphic: <a...
2
9141
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
2
5390
by: Whitney | last post by:
I ran across a chunk of code that allows me to blend images in and out (works great!) but now I need to figure out a way to randomize the order that these images appear. I have a bunch of pics and...
8
2018
by: drillbit_99 | last post by:
I have an HTML page of thumbnail images. Each image can begin a slideshow of the images on the page by clicking on the image. This opens another HTML page that begins the slideshow using large...
6
1913
by: busterama | last post by:
It's probably something simple, but I just can't find the solution. I'm using the javascript slideshow code at http://javascript.internet.com/miscellaneous/fading-slide-show.html for a slideshow...
1
3334
by: ttamilvanan81 | last post by:
Hai everyone, I need to provide the slideshow for the images. I have upload the images into database. Then i will retrive all the images from the database and provide the slideshow for those...
4
1474
by: Terry | last post by:
Hi folks. I am about to embark on creating a slideshow using javascript and css. I was wondering what do people consider the best way to preload the images to be used within the show. I saw...
3
1960
by: kennykenn | last post by:
im producing a banner and want the banner to rotate and fade in and out to the next image. i want to link each image to a SEPERATE site! I can get it to work with out the fading effect and can get...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.