A stunning, fully-featured image slider/gallery built with vanilla JavaScript, HTML, and CSS. This elegant photo gallery showcases dark nature photography with smooth transitions, auto-play functionality, and a modern dark-themed interface.
- ๐ผ๏ธ Image Slider - Smooth sliding transitions between images
- โญ๏ธ Navigation Controls - Previous/Next buttons with elegant styling
- ๐ Dot Indicators - Interactive dots for direct slide navigation
- โก Auto-Play - Automatic slide rotation every 5 seconds
- โธ๏ธ Hover Pause - Auto-play pauses when hovering over images
- ๐ Infinite Loop - Seamlessly loops from last to first image
- ๐ฑ Responsive Design - Adapts to different screen sizes
- ๐ฅ๏ธ Fullscreen Mode - Toggle fullscreen for immersive viewing
- ๐จ Dark Theme - Elegant dark mode design with subtle patterns
- ๐ซ Smooth Animations - Cubic-bezier transitions for professional feel
- ๐ฏ Backdrop Blur - Modern glassmorphism effects on controls
- โจ Hover Effects - Interactive feedback on all clickable elements
The gallery features 5 stunning dark nature photographs from Pixabay, including:
- Mysterious forest scenes
- Mountain landscapes
- Dramatic fields
- Atmospheric roads
- Silhouetted trees
- HTML5 - Semantic markup structure
- CSS3 - Advanced styling with modern features:
- Flexbox layout
- CSS transforms and transitions
- Backdrop filters (glassmorphism)
- Custom SVG patterns
- Responsive design
- JavaScript (ES6) - Interactive functionality:
- DOM manipulation
- Event handling
- Timer management
- Dynamic element creation
-
Clone the repository
git clone <repository-url> cd "Image Slider"
-
Open in browser Simply open
index.htmlin your web browser:# Windows start index.html # macOS open index.html # Linux xdg-open index.html
Or use a local development server:
# Using Python python -m http.server 8000 # Using Node.js (if http-server is installed) npx http-server
-
Access the gallery Navigate to
http://localhost:8000(if using a local server)
Image Slider/
โ
โโโ index.html # Main HTML structure
โโโ style.css # Styling and animations
โโโ script.js # Interactive functionality
โโโ README.md # Project documentation
-
Next/Previous Buttons
- Click the Next button (right arrow) to advance
- Click the Prev button (left arrow) to go back
-
Dot Navigation
- Click any dot at the bottom to jump to that specific image
-
Fullscreen Mode
- Click the โถ button (top-right) to enter fullscreen
- Click the โคข button to exit fullscreen
-
Auto-Play
- Images automatically advance every 5 seconds
- Hover over the slider to pause auto-play
- Move mouse away to resume auto-play
While basic keyboard navigation is not yet implemented, you can easily extend the functionality by adding keyboard event listeners.
Edit the index.html file and replace the image URLs:
<div class="slider-images">
<img src="YOUR_IMAGE_URL_1" alt="Image 1">
<img src="YOUR_IMAGE_URL_2" alt="Image 2">
<!-- Add more images as needed -->
</div>In script.js, modify the interval value (in milliseconds):
function startAutoSlide() {
autoSlideInterval = setInterval(nextSlide, 5000); // Change 5000 to desired ms
}In style.css, adjust the container size:
.slider-container {
width: 800px; /* Change width */
height: 450px; /* Change height */
}Modify the color variables in style.css:
body {
background-color: #121212; /* Main background */
}
.slider-container {
border: 2px solid #333; /* Border color */
background-color: #1a1a1a; /* Container background */
}Uses CSS cubic-bezier timing functions for professional, smooth animations:
transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);Modern frosted-glass effect on buttons using backdrop-filter:
backdrop-filter: blur(5px);JavaScript dynamically calculates slider width on window resize:
window.addEventListener('resize', () => {
goToSlide(currentIndex);
});Auto-play timer resets when user interacts with the slider, providing a better user experience.
- โ Chrome/Edge (latest)
- โ Firefox (latest)
- โ Safari (latest)
- โ Opera (latest)
Note: Backdrop-filter may have limited support in older browsers.
The gallery is designed to work on various screen sizes. For optimal mobile experience, consider adding these viewport adjustments:
@media (max-width: 768px) {
.slider-container {
width: 100%;
height: 300px;
}
}Potential features to add:
- โจ๏ธ Keyboard navigation (arrow keys)
- ๐ Touch/swipe gestures for mobile
- ๐ฌ Lazy loading for better performance
- ๐ Image zoom functionality
- ๐ธ Thumbnail preview strip
- ๐ต Optional background music
- ๐พ Save favorite images
- ๐ Social sharing buttons
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Created with โค๏ธ as part of an internship project.
- Images sourced from Pixabay
- Font: Montserrat by Google Fonts
- SVG pattern inspired by Hero Patterns
If you have any questions or run into issues, please open an issue in the repository.
โญ If you find this project useful, please consider giving it a star!