Thanks for ur reply @OSUblake
I understand. Can u please tell me if my js code is correct or not? or am i following the correct method?
gsap.registerPlugin(ScrollTrigger);
ScrollTrigger.matchMedia({
//Large
"(min-width: 800)": function() {
//Here, in css the property is hidden and translateY:30px
gsap.to(".skill_bg", {
scrollTrigger: {
trigger: "#skills",
start: "10px 40%",
},
y: 0,
opacity: 1,
duration: 1
});
//Here in css, the property is display:block... And im hiding it in this media query
gsap.to("#blur", {
scrollTrigger: {
trigger: "#skills",
start: "10px 40%",
},
display: "none",
duration: 2
});
//Here in css, the property is top:-20%
gsap.to(".small-box", {
scrollTrigger: {
trigger: "#skills",
start: "10px 40%",
},
top: "-10%",
display: "initial",
width: "270px",
height: "350px",
duration: 1
});
//Here in css, the property is hidden and opacity:0
gsap.to("#hide", {
scrollTrigger: {
trigger: ".small-box",
start: "10px 40%",
},
display: "block",
opacity: 1,
delay: 1,
duration: 2
});
//Here in css, the property is left:10% and in this media query im sliding it to left 70%
gsap.to(".small-box", {
scrollTrigger: {
trigger: ".small-box",
start: "10px 40%",
},
left: "70%",
delay: 1,
duration: 1
});
//Here in css, the property width is 0% and im increasing the width about 75% in this media query.
gsap.to(CSSRulePlugin.getRule("#timeline::before"), {
scrollTrigger: {
trigger: "#timeline-wrap",
start: "40px 120%",
},
width: "75%",
opacity: 1,
duration: 2
});
//Here in css, the property is x:-30px...and i have 4 elements in this div.
gsap.to(".marker", {
scrollTrigger: {
trigger: "#timeline-wrap",
start: "40px 120%",
},
x: 0,
opacity: 1,
duration: 1.2,
stagger: 0.30
});
},
//medium
"(max-width: 799px) and (min-width: 524)": function() {
//I dont want to change the animation i have in large screen. Thats why i wrote the same code here again.
gsap.to(".skill_bg", {
scrollTrigger: {
trigger: "#skills",
start: "10px 40%",
},
y: 0,
opacity: 1,
duration: 1
});
//I dont want to change the animation i have in large screen. Thats why i wrote the same code here again.
gsap.to("#blur", {
scrollTrigger: {
trigger: "#skills",
start: "10px 40%",
},
display: "none",
duration: 2
});
//I dont want to change the animation i have in large screen. Thats why i wrote the same code here again.
gsap.to(".small-box", {
scrollTrigger: {
trigger: "#skills",
start: "10px 40%",
},
top: "-10%",
display: "initial",
width: "270px",
height: "350px",
duration: 1
});
//I dont want to change the animation i have in large screen. Thats why i wrote the same code here again.
gsap.to("#hide", {
scrollTrigger: {
trigger: ".small-box",
start: "10px 40%",
},
display: "block",
opacity: 1,
delay: 1,
duration: 2
});
//In css, the property is left:0%. I wanted to show that property as an slider in large screen and the value was left:75%. But now in medium screen, i want to decrease the sliding, like left:20%. And this is not working.
gsap.to(".small-box", {
scrollTrigger: {
trigger: ".small-box",
start: "10px 40%",
},
left: "20%",
delay: 1,
duration: 1
});
//Here, in css the property is x:-30px...and i have 4 elements in this div. The stagger was 0.30 in large screen. Now for medium screen i want to decrese it, like 0.15. But its not working
gsap.to(".marker", {
scrollTrigger: {
trigger: "#timeline-wrap",
start: "40px 120%",
},
x: 0,
opacity: 1,
duration: 1,
stagger: 0.15
});
}
});