2.2 KiB
2.2 KiB
Reddit Clone
A responsive Reddit-like application with infinite scroll functionality that displays the latest Reddit articles.
Features
- Infinite Scroll: Automatically loads more posts as you scroll down
- Responsive Design: Works well on both desktop and mobile devices
- Image Preview: Each post displays a picture frame with a placeholder image
- Modern UI: Clean, attractive interface with hover effects and smooth transitions
Project Structure
.
├── index.html # Main HTML structure
├── styles.css # Responsive styling
└── app.js # JavaScript logic for posts and infinite scroll
How It Works
- The application loads the first 10 Reddit posts when the page is initially loaded
- As users scroll down, it automatically loads more posts (10 at a time)
- Uses Intersection Observer API for efficient infinite scrolling
- Falls back to manual scroll detection for older browsers
- Each post displays:
- A title
- An image frame
- A link to the original Reddit post
Implementation Details
- Responsive Design: Uses CSS Grid for adaptive layouts that work on mobile and desktop
- Performance: Lazy loading of images and efficient scroll handling
- Mock Data: Currently uses mock data for demonstration purposes (will be replaced with real API calls)
- User Experience: Loading indicators and smooth animations
How to Use
- Open
index.htmlin a web browser - Scroll down to see more posts load automatically
- Click on post titles to view them on Reddit
Customization
To connect to a real Reddit API:
- Replace the mock data in
app.jswith actual API calls - Update the
fetchRedditPosts()andfetchMorePosts()functions to fetch from Reddit's API - Adjust styling in
styles.cssto match desired aesthetics
Technologies Used
- HTML5
- CSS3 (Grid, Flexbox, Media Queries)
- JavaScript ES6+
- Intersection Observer API for efficient scrolling
Responsive Design
The application is fully responsive and will adapt to:
- Desktop: Grid layout with 2-3 columns based on screen width
- Tablet: Reduced grid columns
- Mobile: Single column layout with appropriate spacing