Where should I add my scripts? #78197
-
SummaryI want to add a basic I just added
This is the JS $(document).ready(function () {
$('.coming-soon, .coming-soon-overlay').hover(
function () {
$('.coming-soon').css({
'filter': 'blur(0px)',
'animation': 'comingSoonAnimation 0.5s ease 0s 1 normal forwards'
});
$('.coming-soon-overlay').css('opacity', '0');
},
function () {
$('.coming-soon').css({
'filter': 'blur(7px)',
'animation': 'none'
});
$('.coming-soon-overlay').css('opacity', '1');
}
);
}); Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I think one way to do this, is to just import it, making sure to add Like, if I have: 'use client'
if (typeof window !== 'undefined') {
console.log("hello")
} Then, on my page.tsx I could do: import '../scripts/my.script'
export default function Home() {
return (
<SomeUI />
} |
Beta Was this translation helpful? Give feedback.
-
@DemeSzabolcs Can I ask you a question? Why do you prefer to use script for this situation? It's better to use CSS rather than using JavaScript. It's more performance and server-component-friendly. What did you think ? |
Beta Was this translation helpful? Give feedback.
So, I have:
And that gives:
And the script: