SSI Random Image used Server Side Includes for image rotation. Today, JavaScript handles this client-side with better performance and features.
Image Rotation
Simple, dependency-free image rotation. Works in all browsers, no server processing needed.
const images = [
'/images/banner1.jpg',
'/images/banner2.jpg',
'/images/banner3.jpg'
];
const img = document.getElementById('rotating-image');
let current = 0;
function rotateImage() {
current = (current + 1) % images.length;
img.src = images[current];
}
// Rotate every 5 seconds
setInterval(rotateImage, 5000);
Pure CSS animation for image rotation. No JavaScript needed, uses keyframes animation.
@keyframes imageRotate {
0%, 33% { opacity: 1; }
34%, 100% { opacity: 0; }
}
.rotating-images img {
position: absolute;
animation: imageRotate 15s infinite;
}
.rotating-images img:nth-child(2) { animation-delay: 5s; }
.rotating-images img:nth-child(3) { animation-delay: 10s; }
Most popular modern slider. Touch-enabled, responsive, works with React, Vue, Angular.
Lightweight, accessible slider. No dependencies, excellent documentation.
Touch, responsive, flickable carousels. Physics-based animations, free for personal use.
| Feature | SSI Script | JavaScript |
|---|---|---|
| Server processing | Required | None |
| Real-time rotation | Page refresh | Automatic |
| Transitions | None | CSS/JS effects |
| File extension | .shtml required | Any |
| Server config | SSI enabled | Not needed |
| Caching | Complex | Simple |
| Performance | Server load | Client-side |
Simple rotation: Native JavaScript
No JS needed: CSS animation
Full features: Swiper
Lightweight: Splide