-
☆ A M B ☆
- 24,524 Posts
here’s a simple slide show image for a small block.
Use it like so (I put this in a chunk so I can put it wherever I want):
<div id="image">
<img id="slides" src="assets/images/slides/flowers.jpg" alt="desert scenes" width="130" height="164"/>
[[InitSlides?folder=`slides`&interval=`5`]]
</div>
Note that it is VERY IMPORTANT to have the snippet tags AFTER the initial image tag! Also the initial image MUST have the id="slides" attribute.
Put the .js file in assets/js; create the js folder if necessary.
I’m using it on my site
http://www.sottwell.com with the "theo" template. (I really like that template, Theo!

)
Really cool! Nice work Susan!
-
☆ A M B ☆
- 24,524 Posts
The original javascript I used also "fades" with IE; I ripped it out since I’ll never see it

Here’s the original Javascript, if the fade is really wanted.
// Browser Slide-Show script.
// With image cross fade effect for those browsers that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs)
{
var imageSeparator = imageFiles.indexOf(";");
var nextImage = imageFiles.substring(0,imageSeparator);
if (document.all)
{
document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
document.getElementById(pictureName).filters.blendTrans.Apply();
}
document.getElementById(pictureName).src = nextImage;
if (document.all)
{
document.getElementById(pictureName).filters.blendTrans.Play();
}
var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
+ ';' + nextImage;
setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
displaySecs*1000);
// Cache the next image to improve performance.
imageSeparator = futureImages.indexOf(";");
nextImage = futureImages.substring(0,imageSeparator);
if (slideCache[nextImage] == null) {
slideCache[nextImage] = new Image;
slideCache[nextImage].src = nextImage;
}
}
I would like to get this implemented, but I am not sure where to place the InitSlides.snippet.php file. Where do I put this file?
-
☆ A M B ☆
- 24,524 Posts
Create a new Snippet in the manager, and copy/paste the text from the file. Name the snippet InitSlides.
(I only gave the file the .php extension so my color-coded editor will automatically color-code it when I open it.)