Open dawidk92 opened 4 months ago
Where do you define your styles? The polyfill – currently - only works with rules present in inlined style blocks.
Don’t work:
<link rel="stylesheet" …>
The latter is tracked in https://github.com/flackr/scroll-timeline/issues/78
I'm using Next.js with styled-components
for styling.
Styles are dynamically generated and injected into the <style>
tag within the <head>
tag of the document. This setup should, in theory, align with the requirement for inlined style blocks as the styles are not applied via the style
attribute directly on elements nor through external style sheets linked via <link rel="stylesheet" href="...">
.
Here you can find an example of this kind of setup: https://github.com/vercel/next.js/tree/canary/examples/with-styled-components
I'm having the same issue can confirm the polyfill has no effect in a brand new next.js project
<Script async src="https://flackr.github.io/scroll-timeline/dist/scroll-timeline.js" />
Put that into my layout component, and it seems to have no effect.
I've successfully used this previously in an Astro project, with no issues. Would really love to get this working in next.js!!
The polyfill can’t be loaded using async
as it needs to catch the animations starting.
I put some ideas on https://github.com/flackr/scroll-timeline/issues/260 for how we could handle loading the polyfill asynchronously and still detect existing or already finished css animations.
Environment
Description
I'm encountering an issue integrating the
scroll-timeline
polyfill into my Next.js project, aiming to enable scroll-linked animations using CSS Scroll Timeline. Despite correctly importing the script in mypages/_app.tsx
file, the polyfill does not activate, and animations linked to scroll or view timelines do not trigger as expected.Steps to Reproduce
pages/_app.tsx
file of a Next.js project, importScript
fromnext/script
.scroll-timeline
polyfill using theScript
tag as follows:animation-timeline: scroll();
andanimation-timeline: view();
to define scroll-linked animations.Expected Result:
Actual Result:
animation-timeline: scroll();
noranimation-timeline: view();
have any effect, and the expected animations do not occur.Attempted Solutions
Any assistance or insights into resolving this integration issue would be greatly appreciated. Thank you!