Intersection Observer Patterns

Implement common Intersection Observer patterns for lazy loading, animations, and tracking.

6/11/2026
Prompt
I need to implement Intersection Observer for various features.

**Use Cases Needed:**
- Lazy loading images: [yes/no]
- Infinite scroll: [yes/no]
- Animate on scroll: [yes/no]
- Analytics tracking: [yes/no]
- Sticky headers: [yes/no]

**Framework:** [React/Vue/vanilla]

**Current Implementation (if any):**
```javascript
[paste existing code]
```

**Requirements:**
- Threshold values: [describe]
- Root margin needs: [describe]
- Performance constraints: [if any]

Please provide:
1. Reusable Intersection Observer hook/utility
2. Implementation for each use case
3. Performance optimization techniques
4. Cleanup and memory management
5. Browser compatibility handling
6. Debugging approaches
7. Integration examples

Or press ⌘C to copy

Ready to use?

Copy and paste into your favorite AI tool

Works With

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...