EmbedManager
A lightweight JavaScript library for effortlessly embedding content with lazy loading
Features
Responsive Design
Automatically adjusts embeds to fit any screen size with proper aspect ratio preservation.
Lazy Loading
Improves page performance by loading embeds only when they're visible in the viewport.
Enhanced Security
Includes proper sandbox attributes and referrer policies to keep your site secure.
Accessibility
Built with accessibility in mind, including ARIA attributes and proper focus management.
Multiple Services
Supports YouTube, Vimeo, Twitch, CodePen, Twitter, Instagram, TikTok, and more.
Customizable
Easily configure embeds with data attributes for precise control over appearance and behavior.
Quick Start
1. Include the script
<script src="embedManager.js"></script>
2. Add your embed container
<div class="embed-container"
data-type="youtube"
data-src="https://www.youtube.com/embed/OX1XxWOTiq8"
data-title="YouTube Video">
</div>
3. That's it! The embed will load when scrolled into view
Supported Services
YouTube
Vimeo
Twitch
CodePen
Twitter/X
Instagram
TikTok
Spotify
SoundCloud
GitHub Gist
Google Maps
General Websites