iframe-preview
Skill0 starsChanged 4 months agoMITView on GitHub
Auto-scaling iframe website preview with before/after toggle. Measures container width and scales a full-width (1440px) iframe to fit. Before state shows static image, click triggers animated transition to live iframe. For website redesign demos, portfolio previews.
In this repository37 other files it gives its agents.
- .agents/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- vercel-composition-patterns/AGENTS.mdAGENTS.md
- senior-frontendSkill
- vercel-composition-patternsSkill
- bento-designSkill
- fanned-cardsSkill
- flip-cardSkill
- floating-quotesSkill
- githubSkill
- glassmorphism-uiSkill
- gmail-proxySkill
- googleSkill
- hippocampusSkill
- html-pdf-exportSkill
- infinite-canvasSkill
- matrix-textSkill
- nextjs-apiSkill
- nextjs-expertSkill
- pinterestSkill
- railway-deploySkill
- remotion-videoSkill
- scramble-textSkill
- scroll-video-heroSkill
- senior-frontendSkill
- SEOSkill
- ship-websiteSkill
- sound-engineSkill
- stripe-best-practicesSkill
- tilt-cardSkill
- tube-summarySkill
- upload-postSkill
- vercel-composition-patternsSkill
- vercel-deploySkill
- vercel-react-best-practicesSkill
- vertical-fanned-cardsSkill
- video-contentSkill
- war-roomSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Use sandbox="allow-scripts allow-same-origin" for security
- Very specific: line 36
Use loading="lazy" for iframes in carousels (performance)
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
iframe Website Preview
An auto-scaling iframe that fits any container width by measuring the container and applying CSS transform scale. Features a before/after toggle with loading animation.
When to Use
- Website redesign before/after demos
- Portfolio project previews in cards
- Live site embeds in dashboards
- Any context where a full website needs to fit a small container
Architecture
- Container ref measures
offsetWidthon mount - Scale factor =
containerWidth / 1440(assumes 1440px design width) - iframe rendered at native 1440px width, scaled down via
transform: scale() transformOrigin: 'top left'ensures proper positioning- iframe height =
containerHeight / scaleto fill the visible area
Before/After Pattern
- Initial state: static screenshot image with "Update" button overlay
- Click triggers loading spinner (2.2s fake delay)
- Transition: old image fades out, iframe fades in
- iframe scrolls internally (no parent scroll interference)
Key Lessons
- Use
sandbox="allow-scripts allow-same-origin"for security - Set
pointerEvents: 'none'on card-embedded iframes to prevent interaction stealing - Use
loading="lazy"for iframes in carousels (performance) - Measure container on mount AND on resize (ResizeObserver)
- For scroll-controlled video inside iframes, don't use hash anchors
Reference Implementation
See reference/IframePreview.tsx
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

