Tim Maxey .NET Technology Blog & Resources

Javascript clickable slideshow

I did NOT write this, I wanted a javascript slidshow to show off project screen shots and found this code and wanted to make sure I had it in my archives to search for later! Got this off: http://www.javascriptkit.com/howto/show3.shtml 

in head:

<script type="text/javascript">
<!--
//preload images
var image1=new Image()
image1.src="images/screenshot.jpg"
var image2=new Image()
image2.src="images/screenshot2.jpg"
var image3=new Image()
image3.src="images/screenshot3.jpg"
var image4=new Image()
image4.src="images/screenshot4.jpg"
//-->
</script>

In the body where you want the "images" to show up...

<a href="javascript:slidelink()">
<img src="images/screenshot.jpg" name="slide" border="0" width="492" height="354" /></a>
<script type="text/javascript">
<!--
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<4)
step++
else
step=1
setTimeout("slideit()",4000)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="page1.html"
else if (whichimage==2)
window.location="page2.html"
else if (whichimage==3)
window.location="page3.html"
else if (whichimage==4)
window.location="page4.html"
}
//-->
</script>


Feedback

# re: Javascript clickable slideshow

Gravatar I love this feature! It saves a lot of clutter on my sidebar, well not that it's clutter but that it was once sooo long and now it's in a compact little space. I only wish there was a way to speed up or slow down the slideshow so I can get to the blog I want quickly. Oh well can't have it all, huh? :D I use Internet Explorer and at first it was kind of 'skipping' and would only show just a few 'buttons', but after I played around with it a lot I somehow managed to have it flow all the way through. YAY! Thanks for all your tips!!! Your button is in my slideshow too!!! :D 1/27/2010 2:31 AM | Rapid Share

# re: Javascript clickable slideshow

Gravatar Useful information shared..Iam very happy to read this article..thanks for giving us nice info.Fantastic walk-through. I appreciate this post. 3/15/2010 6:50 AM | IT Outsourcing

# re: Javascript clickable slideshow

Gravatar Thanks for sharing these useful information! Hope that you will continue doing nice article like this.
9/16/2010 5:58 AM | IT Infrastructure management

Post a comment





 

Please add 5 and 2 and type the answer here: