FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

slideshow without flash?

 


leo87
is it possible to create a site banner with images sliding one after another,without the use of flash?using css r something like that?any java script?r anyother thing..

I have seen this in many sites..for eg "http://www.indiatourism.com/pondicherry-tourism/index.html"

And is it possible to bring a powerpoint file to HTML?
Mosquito.Tyler
It looks like that particular one is done with javascript.
It is probably done sing a timed function with an array.

The array would contain the source path of the pictures, and hte function would change the 'src' attribute of the <img> tag.

If you would like, I can go into more detail, but I don't want to unless you really want me to Wink .

If you want you can look at the javascript lessons, tutorials, and references at w3 Schools. They might help you

Again, if you watn I will post a small tutorial for you, but take a look at w3schools and see if you can figure it out.

I know that there is a way to put power point productions on the web, but you have to have power point to view them. (i would suggest using javascript)

Good luck
sonam
I am create one in PHP. Just visit my site and find there Fisherman's slide show or you can use Hercules banner rotator.
Mosquito.Tyler
OK well, I sent this to you in a PM, i know, but i wanted others to know about it to, so I'm posting it here.

/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\

Ok, well I put some notes in there so you should be able to follow what the javascript is doing. If theres something you don't understand after your done reading this just ask. I'm not that great at explaining things but I'll do my best.

Ok, firstly, in the 'pic' array, you can add more images if you want to as long as they are in the same syntax. By that I mean separated by commas and enclosed in quotation marks. Now if you do add more images, you must alter a value in the script so that the added pictures will be shown. I've highlighted the number you need to change in orange, this value must equal the number of pictures you have in your array.

Another item you may want to change is '**IMG ID**', that value can be whatever you ant it to be, just as long as it is the same in both instances.

And finally, the timeout. At the very bottom of the javascript code is a value, that value is set in miliseconds. It controls how often your pictures change. a value of 1000 is equal to one second.

A tip: Make sure all your pictures are the same size, or at least have the same Height-to-width ratio.

Code:


<html>
<head>
<title>TITLE</title>
<script type="text/javascript">
//
// First we're going to make an array that will hold all the file paths to each picture so that later we can call them into our function.
// Obviously you will replace these values with actual paths to your images you want in your slideshow.
//

var pic = new Array("images/pic0.jpg","images/pic1.jpg","images/pic2.jpg");

//
// Now we're going to create a variable that will determine which picture is displayed
//

var x = 0;

//
// Now we're going to make the function that will switch out the pictures. The function will replace the 'src' attribute of the <img> tag, then after a predefined amount of time, it will change it again, over and over.
//

function changepic() {
   //Here we will find the image based on it's 'id' attribute, and assign it to a value.
   image = document.getElementById('**IMG ID**');
   //Now we are going to make a small if/then statement to make sure that our vaiable 'whichpic' stays between 0 and 3.
   if (x >= 3){
      x = 0;
      };
   //Now here come the fun part. This is the part that will change the pictures.
   image.src = pic[x];
   //Now we increase 'x' so that the picture will change every time.
   x = x + 1;
   //And now we are going to create a timing statement so that this function will be repeated infinitely. The number '10000' is how many miliseconds it will wait until it repeeats. 1000 = 1 second. So right now it is set for 10 seconds. You can change this number as you see fit.
   t = setTimeout("changepic()",10000);
   }

</script>
</head>
<body onload="changepic()">
<table>
   <tr>
      <td><img width="500" src="images/pic0.jpg" id="**IMG ID**" /></td>
      <td>HEY LOOK, THE IMAGE CHANGES! JAVASCRIPT IS COOL!</td>
   </tr>
</table>
</body>
</html>


Ok, that's all I got for ya, remember if theres something you don't understand, just ask Wink .

Happy Scripting,
~Tyler

EDIT:: for the rest of you, If you view this web page in Firefox, the slideshow doesn't appear as intended, in IE, there is a fading effect. I guess you learn something new every day.

The path to the javascript they use fo it is here.

That is all.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.