← All writingNotes · November 2026 · 4 min read
How I put live websites inside my portfolio
Screenshots show what a project looked like. I wanted visitors to see what it actually does.
When I rebuilt this portfolio, I had a simple goal for the projects page: no more static pictures. Every project should run right on the page, so anyone can click around a real app without leaving.
1. Publish every project
A live preview needs a live site. Each of my project repositories is published with GitHub Pages, which serves the files in a repo as a website at tinapaaay.github.io/repo-name. Most of my projects are plain HTML, CSS, and JavaScript, so they work there with no changes.
2. Show the site in a browser frame
Each project sits inside an <iframe>, wrapped in a small browser window with a URL bar. An iframe shows another web page inside yours — exactly what a preview needs.
3. Shrink a desktop site to fit
The tricky part: a project designed for a 1280px-wide screen looks squashed in a 700px box. Instead of letting it reflow, I render the iframe at full desktop width and scale it down with CSS:
const scale = frameWidth / 1280;
viewport.style.width = "1280px";
viewport.style.height = frameHeight / scale + "px";
viewport.style.transform = `scale(${scale})`;
The site thinks it's on a laptop, but it fits neatly in the frame. A Mobile button switches the iframe to 390px wide and shows it inside a phone outline.
Try it: this is Leemo Cocktails, running live. Click the window to scroll it, or switch to Mobile.
4. Don't trap the scroll
If the mouse is over an iframe, the scroll wheel scrolls the project instead of the page — which feels like being stuck. So previews start "asleep": a transparent cover sits on top, and clicking it lets you use the site. Move the mouse away and the page scrolls normally again.
5. Load only what's needed
Ten live websites at once is heavy. An IntersectionObserver loads each one only when you scroll near it. On phones, or when data saver is on, nothing loads until you tap — until then a screenshot stands in.
What I learned
- Publishing small projects early pays off — they become part of the portfolio for free.
- Scaling with
transformkeeps the original design intact, instead of a squeezed version. - Interactive embeds need clear rules about who gets the mouse and the scroll.
- Performance is part of the design, especially on phones.