mirror of
https://github.com/timmypidashev/web.git
synced 2026-04-14 11:03:50 +00:00
mobile optimizations
This commit is contained in:
@@ -12,8 +12,9 @@ export default function Intro() {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const inView = rect.top < window.innerHeight && rect.bottom > 0;
|
||||
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
|
||||
const isSpaNav = !!(window as any).__astroNavigation;
|
||||
|
||||
if (inView && isReload) {
|
||||
if (inView && (isReload || isSpaNav)) {
|
||||
setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,9 @@ const Stats = () => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const inView = rect.top < window.innerHeight && rect.bottom > 0;
|
||||
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
|
||||
const isSpaNav = !!(window as any).__astroNavigation;
|
||||
|
||||
if (inView && isReload) {
|
||||
if (inView && (isReload || isSpaNav)) {
|
||||
setSkipAnim(true);
|
||||
setIsVisible(true);
|
||||
return;
|
||||
|
||||
@@ -35,8 +35,9 @@ const DetailedStats = () => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const inView = rect.top < window.innerHeight && rect.bottom > 0;
|
||||
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
|
||||
const isSpaNav = !!(window as any).__astroNavigation;
|
||||
|
||||
if (inView && isReload) {
|
||||
if (inView && (isReload || isSpaNav)) {
|
||||
setSkipAnim(true);
|
||||
setVisible(true);
|
||||
return;
|
||||
|
||||
@@ -51,8 +51,9 @@ function TimelineCard({ item, index }: { item: (typeof timelineItems)[number]; i
|
||||
const rect = el.getBoundingClientRect();
|
||||
const inView = rect.top < window.innerHeight && rect.bottom > 0;
|
||||
const isReload = performance.getEntriesByType?.("navigation")?.[0]?.type === "reload";
|
||||
const isSpaNav = !!(window as any).__astroNavigation;
|
||||
|
||||
if (inView && isReload) {
|
||||
if (inView && (isReload || isSpaNav)) {
|
||||
setSkip(true);
|
||||
setVisible(true);
|
||||
return;
|
||||
|
||||
@@ -74,8 +74,8 @@ const ogImage = "https://timmypidashev.dev/og-image.jpg";
|
||||
});
|
||||
document.addEventListener('astro:after-swap', function() {
|
||||
var m = getMask();
|
||||
// Wait for React to hydrate before revealing
|
||||
setTimeout(function() { m.classList.remove('active'); }, 50);
|
||||
// Wait longer for canvas + overlays to hydrate on index page
|
||||
setTimeout(function() { m.classList.remove('active'); }, 150);
|
||||
});
|
||||
// Mark SPA navigations so AnimateIn can detect them
|
||||
document.addEventListener('astro:after-swap', function() {
|
||||
|
||||
Reference in New Issue
Block a user