File size: 9,182 Bytes
658b1b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Right-to-Left Image Carousel</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <style>
        .carousel-container {
            width: 100%;
            overflow: hidden;
            position: relative;
        }
        
        .carousel-track {
            display: flex;
            transition: transform 0.5s ease-in-out;
        }
        
        .carousel-slide {
            min-width: 100%;
            box-sizing: border-box;
        }
        
        .carousel-slide img {
            width: 100%;
            height: auto;
            object-fit: cover;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        
        .carousel-nav {
            position: absolute;
            bottom: 20px;
            left: 20px;
            z-index: 10;
        }
        
        .carousel-btn {
            background-color: rgba(255, 255, 255, 0.7);
            color: #333;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            font-weight: bold;
            transition: all 0.3s ease;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        
        .carousel-btn:hover {
            background-color: rgba(255, 255, 255, 0.9);
            transform: translateY(-2px);
        }
        
        .carousel-btn:active {
            transform: translateY(0);
        }
        
        .slide-indicators {
            display: flex;
            justify-content: center;
            margin-top: 15px;
        }
        
        .indicator {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: #ccc;
            margin: 0 5px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }
        
        .indicator.active {
            background-color: #555;
        }
    </style>
</head>
<body class="bg-gray-100 min-h-screen flex flex-col items-center justify-center p-4">
    <div class="max-w-4xl w-full bg-white rounded-xl shadow-lg overflow-hidden p-6">
        <h1 class="text-3xl font-bold text-center text-gray-800 mb-8">Nature Gallery</h1>
        
        <div class="carousel-container relative">
            <div class="carousel-track" id="carouselTrack">
                <div class="carousel-slide">
                    <img src="https://source.unsplash.com/random/800x500/?mountain" alt="Mountain landscape">
                    <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4">
                        <h3 class="text-white text-xl font-semibold">Mountain Majesty</h3>
                        <p class="text-white/80">The breathtaking views of alpine peaks</p>
                    </div>
                </div>
                <div class="carousel-slide">
                    <img src="https://source.unsplash.com/random/800x500/?forest" alt="Forest landscape">
                    <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4">
                        <h3 class="text-white text-xl font-semibold">Enchanted Forest</h3>
                        <p class="text-white/80">The mysterious beauty of ancient woods</p>
                    </div>
                </div>
                <div class="carousel-slide">
                    <img src="https://source.unsplash.com/random/800x500/?ocean" alt="Ocean landscape">
                    <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4">
                        <h3 class="text-white text-xl font-semibold">Ocean Waves</h3>
                        <p class="text-white/80">The endless dance of sea and shore</p>
                    </div>
                </div>
                <div class="carousel-slide">
                    <img src="https://source.unsplash.com/random/800x500/?desert" alt="Desert landscape">
                    <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4">
                        <h3 class="text-white text-xl font-semibold">Desert Sands</h3>
                        <p class="text-white/80">The golden expanse of shifting dunes</p>
                    </div>
                </div>
                <div class="carousel-slide">
                    <img src="https://source.unsplash.com/random/800x500/?waterfall" alt="Waterfall landscape">
                    <div class="absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4">
                        <h3 class="text-white text-xl font-semibold">Cascading Waters</h3>
                        <p class="text-white/80">The powerful flow of nature's force</p>
                    </div>
                </div>
            </div>
            
            <div class="carousel-nav">
                <button class="carousel-btn" id="nextBtn">Next →</button>
            </div>
        </div>
        
        <div class="slide-indicators mt-4" id="indicators">
            <!-- Indicators will be added by JavaScript -->
        </div>
        
        <div class="mt-8 text-center text-gray-600">
            <p>Click the "Next" button to see more beautiful nature scenes</p>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const track = document.getElementById('carouselTrack');
            const nextBtn = document.getElementById('nextBtn');
            const indicatorsContainer = document.getElementById('indicators');
            const slides = document.querySelectorAll('.carousel-slide');
            let currentIndex = 0;
            
            // Create indicators
            slides.forEach((_, index) => {
                const indicator = document.createElement('div');
                indicator.classList.add('indicator');
                if (index === 0) indicator.classList.add('active');
                indicator.addEventListener('click', () => {
                    goToSlide(index);
                });
                indicatorsContainer.appendChild(indicator);
            });
            
            const indicators = document.querySelectorAll('.indicator');
            
            function updateCarousel() {
                track.style.transform = `translateX(-${currentIndex * 100}%)`;
                
                // Update indicators
                indicators.forEach((indicator, index) => {
                    if (index === currentIndex) {
                        indicator.classList.add('active');
                    } else {
                        indicator.classList.remove('active');
                    }
                });
            }
            
            function goToSlide(index) {
                currentIndex = index;
                updateCarousel();
            }
            
            function nextSlide() {
                currentIndex = (currentIndex + 1) % slides.length;
                updateCarousel();
            }
            
            nextBtn.addEventListener('click', nextSlide);
            
            // Auto-advance every 5 seconds (optional)
            let autoSlide = setInterval(nextSlide, 5000);
            
            // Pause auto-slide on hover
            track.parentElement.addEventListener('mouseenter', () => {
                clearInterval(autoSlide);
            });
            
            track.parentElement.addEventListener('mouseleave', () => {
                autoSlide = setInterval(nextSlide, 5000);
            });
            
            // Touch support for mobile devices
            let touchStartX = 0;
            let touchEndX = 0;
            
            track.addEventListener('touchstart', (e) => {
                touchStartX = e.changedTouches[0].screenX;
            });
            
            track.addEventListener('touchend', (e) => {
                touchEndX = e.changedTouches[0].screenX;
                handleSwipe();
            });
            
            function handleSwipe() {
                if (touchEndX < touchStartX) {
                    // Swipe left - next slide
                    nextSlide();
                }
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Swordartoffline/test-001a-deepsite-imagecarouselhtml" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>