sap.registerPlugin(ScrollTrigger, Flip);
const main = document.querySelector(".small-grid");
const blue = document.querySelector(".title-sticky-wr");
const boxes = gsap.utils.toArray(".grid-item-wr");
function flipBoxes(target, container) {
let state = Flip.getState(boxes);
boxes.forEach((box) => container.appendChild(box));
return Flip.from(state, {
scale: true,
ease: "power3.out",
duration: 1,
stagger: 0.2
});
}
ScrollTrigger.create({
trigger: "#one",
start: "top top",
end: "bottom bottom", // ScrollTrigger end parameter changed
onToggle: self => {
if (self.isActive) {
flipBoxes(blue, main);
}
}
});
ScrollTrigger.create({
trigger: "#one",
start: "bottom top", // ScrollTrigger start parameter changed
end: "top bottom", // ScrollTrigger end parameter changed
onToggle: self => {
if (self.isActive) {
flipBoxes(main, blue);
}
}
});
Hello guys, I havethis code which reparents the grid-item-wr on scroll with Flip library from main to blue on scroll and when we scroll up again, it reparents the grid-item-wr once again from blue to main. But not working!