Hello.. So I have Post 1 which have a full/wide width images. I want to apply the opacity for the social share icon on the sidebar to be "0" when it hits on the images and when hitting the end of the article it is going to remain opacity=0,
Therefore I have 3 css class for the 3 triggers
.alignwide
.alignfull
.sidebar-social-wrap
And here is my code. please take a look at the attached images.
The code works well on the Post 1 which has a full/wide width images in the post. contain the class .alignwide and .alignfull in the page.
But the Post 2 do not have any images. so therefore there is no css class '.alignwide' or .'alignfull'. It seems to make the opacity set to 0 when the post is loaded.
May I know how to do it properly?
Thanks.
Post 1
https://bit.ly/3sbM4V1
Post 2
https://bit.ly/3bvU7GM
Sorry I dont know how to use codePen
So I guess I will just paste my code here.
gsap.registerPlugin(ScrollTrigger);
gsap.to(".sidebar-social-wrap", {
duration: .1,
opacity:0,
scrollTrigger: {
trigger: ".alignwide",
start: "top 650px",
end: "bottom 150px",
toggleActions: "play reverse play reverse",
}
});
gsap.to(".sidebar-social-wrap", {
duration: .1,
opacity:0,
scrollTrigger: {
trigger: ".alignfull",
start: "top 650px",
end: "bottom 150px",
toggleActions: "play reverse play reverse",
}
});
gsap.to(".sidebar-social-wrap", {
duration: .1,
opacity:0,
scrollTrigger: {
trigger: ".content-end-row",
start: "top 650px",
end: "bottom 550px",
toggleActions: "play reverse play reverse",
scrub: true
}
});