Skip to content

Commit

Permalink
fix: update workaround for style not applied
Browse files Browse the repository at this point in the history
  • Loading branch information
MaySoMusician committed Jul 17, 2023
1 parent 6069eb6 commit 6d16a3b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ const Home: MyNextPage = () => {
const registerAnimation = () => {
setTimeout(() => {
setShowWebsiteTitle(true);
setTimeout(() => {
// Workaround for the problem of that the style is not applied
if (barBehindMenuRef.current) {
barBehindMenuRef.current.style.clipPath =
"polygon(0% 75%, 100% 56%, 100% 100%, 0% 101%)";
}
}, 240); // delay 0.22s + more small delay

// Workaround for the problem of that the style is not applied
const workaround = (_path?: string) => {
if (!barBehindMenuRef.current) return;
const path =
typeof _path !== "undefined"
? _path
: "polygon(0% 75%, 100% 56%, 100% 100%, 0% 101%)";
barBehindMenuRef.current.style.clipPath = path;
};
setTimeout(workaround, 240); // delay 0.22s + more small delay
setTimeout(workaround, 280); // for mobile
setTimeout(workaround.bind(null, ""), 400); // final attempt
}, 1200);
};

Expand Down

1 comment on commit 6d16a3b

@vercel
Copy link

@vercel vercel bot commented on 6d16a3b Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.