Javascript Image Changer

seaside

New Member
Messages
14
Reaction score
0
Points
0
I have a div on my homepage and I have several images (lets say 5) that I would like to go there. I would like to know how to put one image there and in 8 seconds it changes to the next and then the next etc. then start over. Can anybody help me?
 

seaside

New Member
Messages
14
Reaction score
0
Points
0
Thats pretty cool, but i mean simpler. Just an image that changes with a transition every 8 seconds. Could you or anybody provide some code?
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
well here is an example for the above site. to me its simple and satisfies your needs (transitions and change every 8 seconds)

HTML:
<head>
<script type="text/javascript" src="path/to/jquery.js"></script>
<script type="text/javascript" src="path/to/jquery.cross-slide.js"></script>
</head>
<body>
<script type="text/javascript">
   jQuery(function() {
      jQuery('#imgHold').crossSlide({
      sleep: 7.5,
      fade: .5
   }, [
       { src: 'path/to/img1.png' },
       { src: 'path/to/img2.png' },
       { src: 'path/to/img3.png' },
       { src: 'path/to/img4.png' },
       { src: 'path/to/img5.png' }
    ]);
 });
</script>
<div id="imgHold">Text here will not show up if a user has JavaScript turned on. May be used for error messages: "Javascript is turned off, please turn it on to view the slideshow"</div>
</body>


it stays on the image for 7.5 seconds (sleep) and fades in .5 seconds (fade)
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
For diabolo's solution, you have to download the jQuery js libraries and then upload them to your site.
 
Top