CHROMATIC-SYSTEM v1.03_AUTOMATIC_FADE_SLIDESHOW_DISPLAY_ENGINE

INFORMATION & CODE

Automatic Fade Slideshow Display

What It Does

This code creates a responsive, automatic image slideshow (carousel) complete with fading transitions, image captions, slide numbering indicators, and interactive navigation dots. The slideshow cycles through a series of images automatically every 3 seconds, while also allowing users to manually jump to a specific slide by clicking the corresponding navigation dot below the gallery.

How It Works

The system relies on a combination of HTML structure, CSS styling, and JavaScript logic:

  • HTML: Defines the container (.slideshow-wrapper), individual slide items (.slides) containing images, text captions, and index markers, along with clickable dot elements (.dot) linked to a currentSlide() function.
  • CSS: Handles the visual presentation, hiding inactive slides by default (display: none), centering the gallery, styling captions and indicator dots, and providing a smooth CSS @keyframes fade-in animation (.fade) that triggers whenever a new slide appears.
  • JavaScript: Controls the timing and state of the gallery. The showSlides() function loops through all slide and dot elements, hides them, increments the slideIndex, resets back to the first slide if it exceeds the total count, displays the current active slide, highlights the corresponding navigation dot, and uses setTimeout() to recursively call itself every 3,000 milliseconds (3 seconds).

How to Use the Code

To implement and use this code on your website, follow these steps:

  1. Save the HTML code into a file named index.html.
  2. Save the CSS code into a separate file named styles.css in the same directory as your HTML file (ensuring the <link> tag in the HTML head correctly points to it).
  3. Save the JavaScript code into a file named scripts.js in the same directory (ensuring the <script> tag at the bottom of the HTML body correctly points to it). Note: While the HTML includes an onclick="currentSlide(n)" attribute for manual dot navigation, ensure your scripts.js file also includes the corresponding currentSlide function definition if you want manual clicking to work seamlessly alongside the automatic rotation.
  4. Open the index.html file in any web browser to view and test the automatic slideshow. You can easily add more slides by duplicating the .slides HTML block and adding a corresponding .dot span element.

HTML

CSS

JAVASCRIPT