- ์ํฉ
https://webstoryboy.co.kr/1934
11. ํฌํธํด๋ฆฌ์ค ์ฌ์ดํธ ๋ง๋ค๊ธฐ : React-Site : ์ ํ ํ๊ธฐ
Tutorial/portfolio ํฌํธํด๋ฆฌ์ค ์ฌ์ดํธ ๋ง๋ค๊ธฐ - React by @webs 2023. 08. 01. 01 ํฌํธํด๋ฆฌ์ค ์ฌ์ดํธ ๋ง๋ค๊ธฐ : ์ ํ ํ๊ธฐ ๋์ด๋ ์ค๊ฐ ์์ค ๋ค์ด๋ก๋ ์์ฑ ํ๋ฉด ์์ฑ ์ฝ๋ ์์ ๋ณด๊ธฐ ์๊ฐ ์๋ ํ์ธ์! ์น์คํ ๋ฆฌ
webstoryboy.co.kr
์ด ๋ธ๋ก๊ทธ๋ฅผ ์ฐธ๊ณ ํ์ฌ ์ฌ์ดํธ๋ฅผ ๋ง๋ค์๋ค. ์ด ์ฌ์ดํธ์์๋ ํ์ด์ง๊ฐ ํ๋์๋๋ฐ, ๋๋ ๋ฉ๋ด๋ณ๋ก ํ์ด์ง๋ฅผ ๋ง๋ค๊ณ ์ถ์ด์ ๋ผ์ฐํฐ๋ฅผ ์ฌ์ฉํ์ฌ ๋๋์๋ค.
๊ทธ๋ฐ๋ฐ, ๊ณ์ ๋ฉ๋ด๋ฅผ ์ฎ๊ฒจ๊ฐ ๋
execute 'removeChild' on 'Node': The node to be removed is not a child of this node
์ด ์ค๋ฅ๊ฐ ๋ด๋ค.. ๐ข
์ ์ค๋ฅ๋ก ๊ฒ์ํด๋ณด์์ ๋, <> </> ํ๊ทธ๋ฅผ <div></div>๋ก ๋ฐ๊พธ๋ผ๋ ํด๊ฒฐ์ฑ ๋ ์์์ด์,
App.tsx ๋ฅผ ๊ทธ๋ ๊ฒ ๋ฐ๊พธ์์์๋ ๊ณ์ ์ค๋ฅ๊ฐ ๋ฌ๋ค.
ํน์๋ ํด์ ํ์ธํด๋ณด๋, ScrollTrigger์ ์ ์ฉํ ๋ฉ๋ด๋ฅผ ๋๊ฐ์ ๋ค๋ฅธ ๋ฉ๋ด๋ก ์ด๋ํ ๋ ๋ฐ์ํ๋ ๊ฒ์ ๋ณด์๋ค!
๊ทธ๋์ ScrollTrigger์ด๋ Router ํค์๋๋ก ์ด์ฌํ ๊ฒ์์ ํด๋ณธ ๊ฒฐ๊ณผ!!
Issue with ScrollTrigger pinning in Gatsby/React site
Hello, I am experiencing this error: 'NotFoundErrror: Failed to Execute 'removeChild' on 'Node': The node to be removed is not a child of this node.' Specifically when using the 'pinning' attribute. Here is the code snippet being used in my component causi
gsap.com
gsap ํํ์ด์ง์์ ์ด ๊ธ์ ๋ณด๊ฒ ๋์๊ณ ... ๋์ ๊ฑฐ์ ์ ์ฌํ ์ฝ๋์ด์ ๋ถ์ ๋๊ธ์ ๋ดค๋ค.
์ค๋ฅ ์์ธ์ ScrollTrigger๊ฐ ์ ๋๋ ๋ฐํ๋์ง ์์์.. ๋ก ๋ณด์๋๋ฐ, ๋ถ๋ช kill์ด ์์๋๋ ใ _ใ
์ํผ 1์ฐจ์ ์ผ๋ก ๋ฐ๊ฟ๋ณด์๋ค.
// ์๋ ์ฝ๋
useEffect(() => {
gsap.registerPlugin(ScrollTrigger);
const horizontal = horizontalRef.current;
const sections = sectionsRef.current;
const scrollTween = gsap.to(sections, {
xPercent: -120 * (sections.length - 1),
ease: "none",
scrollTrigger: {
trigger: horizontal,
start: "top 56px",
end: () => "+=" + horizontal.offsetWidth,
pin: true,
scrub: 1,
invalidateOnRefresh: true,
anticipatePin: 1,
},
});
return () => {
scrollTween.kill();
};
}, []);
// ๋ฐ๊พผ ์ฝ๋
let ns: any;
if (sections) {
ns = Math.random().toString(36).substring(7);
gsap.to(sections, {
xPercent: -120 * (sections.length - 1),
ease: "none",
scrollTrigger: {
trigger: horizontal,
start: "top 56px",
end: () => "+=" + horizontal.offsetWidth,
pin: true,
scrub: 1,
invalidateOnRefresh: true,
anticipatePin: 1,
},
});
} else {
return;
}
return () => {
const sectionTrigger = ScrollTrigger.getById(`${ns}-title`);
if (sectionTrigger) {
sectionTrigger.kill();
}
};
ํ์ง๋ง... ์ด๊ฒ๋ ๋์ง ์์๋ค...
๊ทธ๋ฌ๋ค๊ฐ... ScrollTrigger์ด ์๋ ์์ค์์ <div>๋ก ๊ฐ์ธ๋ณด๋ผ๋ ๋๊ธ์ ๋ณด๊ณ ํด๋ดค๋๋...
/* ์์ ์ */
<section id="popular" ref={horizontalRef}>
์๋ต...
</section>
/* ์์ ํ */
<div>
<section id="popular" ref={horizontalRef}>
์๋ต...
</section>
</div>
๋๋ค!!!!!!!!!!!!!!!
'Programming > React' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ React ] ์์ด์ฝ ๋๋ฅด๋ฉด ์์ ์ฌ์๋๋ ๊ธฐ๋ฅ (0) | 2024.01.09 |
---|---|
[ React ] ๋ฆฌ๋๋ฐํ ์น ํฐํธ ์ ์ฉ (0) | 2023.12.20 |
[ React ] function(์ ์ธ๋ฌธ) vs const (ํํ์) (0) | 2023.07.27 |
[ React ] ๋ฐ์ํ์น์์ ๊ณ์ ๋ณํ๋ ๋ฒํผ ์์น ์ฐพ์๋ด๊ธฐ, ๋ฒํผ ๋ฐ์ edit ํ ์ ์๋ ๊ทธ๋ฆฌ๋ ๋ถ์ด๊ธฐ (0) | 2023.05.26 |
[ React ] ๊ฐ์ ๋ ๋๋ง (0) | 2023.05.11 |