Skip to content

Instantly share code, notes, and snippets.

View eric3119's full-sized avatar

eric coelho eric3119

View GitHub Profile
@eric3119
eric3119 / overlay-centralize.component.ts
Last active March 5, 2026 01:55
Dynamic positioning container component that keeps elements such as modals, popups, and loading indicators visible and centered in the viewport, even on full-height pages with scrolling.
export class OverlayCentralize extends HTMLElement {
private boundScrollHandler: () => void;
private isSticky = false;
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.boundScrollHandler = this.handleScroll.bind(this);
}