The hero carousel is a full-width slide show that sits directly below the fixed navbar inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Vipul-Gejage/Disney-Hotstar-Clone/llms.txt
Use this file to discover all available pages before exploring further.
Hotstar.html. It cycles through five featured titles — Loki, The Falcon and the Winter Soldier, Wanda vision, Raya, and Luca — automatically advancing every 3000 milliseconds. An infinite loop is achieved by cloning all five slides in JavaScript and appending them to the end of the .carousel element, so when the last real slide transitions out the strip wraps back to position zero without a visible jump.
The Five Slides
Each.slider contains a .slide-content div with a title and description on the left, and a full-height banner image on the right. The five slides in source order are:
| # | Title | Image |
|---|---|---|
| 1 | Loki | images/slider 1.PNG |
| 2 | The Falcon and the Winter Soldier | images/slider 2.PNG |
| 3 | Wanda vision | images/slider 3.PNG |
| 4 | Raya | images/slider 4.PNG |
| 5 | Luca | images/slider 5.PNG |
HTML Structure for a Single Slide
How the Carousel Works
The entire logic lives inHotstar.js inside a DOMContentLoaded event listener. It runs in three steps: clone the slides, define the advance function, then start the interval timer.
Step 1 — cloneSlides()
After the DOM is ready, cloneSlides() iterates over every .slider element captured at page load and calls cloneNode(true) on each one. The deep clones are appended directly to .carousel, effectively doubling the number of visible slides. This means the strip is wide enough to advance through all five originals before silently snapping back to position zero.
Step 2 — showSlide()
Each time showSlide() is called, it increments the index counter and applies a translateX transform to the .carousel element, shifting it left by index × 100% of its own width. The CSS transition on the carousel handles the smooth 0.5-second ease-in-out animation.
Once index reaches or exceeds the original slide count (5), a setTimeout of 500ms fires — long enough for the outgoing transition to finish — and then instantly snaps the carousel back to translateX(0) with transition: none, resetting index to 0. Because the clones are visually identical to the originals, the snap is imperceptible.
Step 3 — setInterval
setInterval(showSlide, 3000) fires showSlide every 3000ms, producing the 3-second auto-advance cycle.
JavaScript Source
CSS
The.carousel-container clips the overflowing slides with overflow-x: hidden and offsets itself below the 80px navbar using margin-top: 80px. The .carousel is a flex row so all .slider children sit side-by-side and can be shifted left with a single translateX. Each .slider is set to flex: 0 0 auto with width: 100% so each slide occupies exactly one full carousel width. The .slide-content overlay uses a left-to-right gradient that fades from a solid dark tone to transparent, ensuring the title text remains legible over the banner image.
Adding New Slides
To add a sixth (or any additional) slide, insert a new.slider div inside the .carousel div in Hotstar.html before the closing </div> comment. The JavaScript automatically picks up all .slider elements at DOMContentLoaded, so no JS changes are needed.