mobile optimizations

This commit is contained in:
2026-04-06 14:15:26 -07:00
parent 14f9ef3ffd
commit dc7ca40b9b
3 changed files with 42 additions and 1 deletions

View File

@@ -49,6 +49,17 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
</style>
<script is:inline set:html={THEME_LOADER_SCRIPT} />
<script is:inline set:html={ANIMATION_LOADER_SCRIPT} />
<script>
document.addEventListener('astro:before-swap', (e) => {
// Instantly hide old page to prevent flash
document.documentElement.style.opacity = '0';
});
document.addEventListener('astro:after-swap', () => {
// Show new page immediately
document.documentElement.style.opacity = '1';
});
</script>
</head>
<body class="bg-background text-foreground min-h-screen flex flex-col">
<Header client:load />

View File

@@ -38,8 +38,27 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
<link rel="icon" type="image/jpeg" href="/me.jpeg" />
<link rel="sitemap" href="/sitemap-index.xml" />
<ClientRouter />
<style>
::view-transition-new(:root) {
animation: none;
}
::view-transition-old(:root) {
animation: none;
}
</style>
<script is:inline set:html={THEME_LOADER_SCRIPT} />
<script is:inline set:html={ANIMATION_LOADER_SCRIPT} />
<script>
document.addEventListener('astro:before-swap', (e) => {
// Instantly hide old page to prevent flash
document.documentElement.style.opacity = '0';
});
document.addEventListener('astro:after-swap', () => {
// Show new page immediately
document.documentElement.style.opacity = '1';
});
</script>
</head>
<body class="bg-background text-foreground overflow-hidden h-screen">
<Header client:load transparent />

View File

@@ -49,6 +49,17 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
</style>
<script is:inline set:html={THEME_LOADER_SCRIPT} />
<script is:inline set:html={ANIMATION_LOADER_SCRIPT} />
<script>
document.addEventListener('astro:before-swap', (e) => {
// Instantly hide old page to prevent flash
document.documentElement.style.opacity = '0';
});
document.addEventListener('astro:after-swap', () => {
// Show new page immediately
document.documentElement.style.opacity = '1';
});
</script>
</head>
<body class="bg-background text-foreground min-h-screen flex flex-col">
<main class="flex-1 flex flex-col">