Skip to content

An interactive image slider/carousel built with HTML, CSS, and JavaScript. Features smooth transitions, prev/next navigation, auto-play, and dot indicators. Demonstrates DOM manipulation, event handling, and responsive design. Perfect for portfolios, product showcases, or any image gallery. Clean code, beginner-friendly.

Notifications You must be signed in to change notification settings

ChitranshSingh/Image-Slider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ™ Dark Nature Gallery

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.

License JavaScript HTML5 CSS3

โœจ Features

Core Functionality

  • ๐Ÿ–ผ๏ธ 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

Advanced Features

  • ๐Ÿ–ฅ๏ธ 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

๐Ÿš€ Demo

The gallery features 5 stunning dark nature photographs from Pixabay, including:

  • Mysterious forest scenes
  • Mountain landscapes
  • Dramatic fields
  • Atmospheric roads
  • Silhouetted trees

๐Ÿ› ๏ธ Tech Stack

  • 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

๐Ÿ“ฆ Installation

  1. Clone the repository

    git clone <repository-url>
    cd "Image Slider"
  2. Open in browser Simply open index.html in 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
  3. Access the gallery Navigate to http://localhost:8000 (if using a local server)

๐Ÿ“ Project Structure

Image Slider/
โ”‚
โ”œโ”€โ”€ index.html          # Main HTML structure
โ”œโ”€โ”€ style.css           # Styling and animations
โ”œโ”€โ”€ script.js           # Interactive functionality
โ””โ”€โ”€ README.md           # Project documentation

๐ŸŽฎ Usage

Basic Controls

  1. Next/Previous Buttons

    • Click the Next button (right arrow) to advance
    • Click the Prev button (left arrow) to go back
  2. Dot Navigation

    • Click any dot at the bottom to jump to that specific image
  3. Fullscreen Mode

    • Click the โ›ถ button (top-right) to enter fullscreen
    • Click the โคข button to exit fullscreen
  4. Auto-Play

    • Images automatically advance every 5 seconds
    • Hover over the slider to pause auto-play
    • Move mouse away to resume auto-play

Keyboard Support

While basic keyboard navigation is not yet implemented, you can easily extend the functionality by adding keyboard event listeners.

๐ŸŽจ Customization

Change Images

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>

Adjust Auto-Play Speed

In script.js, modify the interval value (in milliseconds):

function startAutoSlide() {
    autoSlideInterval = setInterval(nextSlide, 5000); // Change 5000 to desired ms
}

Modify Slider Dimensions

In style.css, adjust the container size:

.slider-container {
    width: 800px;  /* Change width */
    height: 450px; /* Change height */
}

Change Color Scheme

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 */
}

๐ŸŒŸ Key Features Explained

Smooth Transitions

Uses CSS cubic-bezier timing functions for professional, smooth animations:

transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);

Glassmorphism Effects

Modern frosted-glass effect on buttons using backdrop-filter:

backdrop-filter: blur(5px);

Responsive Slider Width

JavaScript dynamically calculates slider width on window resize:

window.addEventListener('resize', () => {
    goToSlide(currentIndex);
});

Smart Timer Management

Auto-play timer resets when user interacts with the slider, providing a better user experience.

๐Ÿ”ง Browser Compatibility

  • โœ… Chrome/Edge (latest)
  • โœ… Firefox (latest)
  • โœ… Safari (latest)
  • โœ… Opera (latest)

Note: Backdrop-filter may have limited support in older browsers.

๐Ÿ“ฑ Responsive Design

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;
    }
}

๐Ÿš€ Future Enhancements

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

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ‘ค Author

Created with โค๏ธ as part of an internship project.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

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!

About

An interactive image slider/carousel built with HTML, CSS, and JavaScript. Features smooth transitions, prev/next navigation, auto-play, and dot indicators. Demonstrates DOM manipulation, event handling, and responsive design. Perfect for portfolios, product showcases, or any image gallery. Clean code, beginner-friendly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published