Jump to content
Search Community

Vue.js ScrollTrigger not work

Cyprian test
Moderator Tag

Recommended Posts

Hello Cyprian

 

I'm not familiar with Vue, but at least on first load, it does work for me.

 

Change makers to markers and you will see.

 

Also, by default it will only play the tween once on enter if you don't define how to control it.

 

Try changing things with regard to the start and toggleActions, like maybe

 

gsap.to("#one",{
	scrollTrigger:{
	  trigger: "#one",
	  markers: true,
	  start: "center center",
	  toggleActions: "play none none reverse"
	},
	x:200, 
	duration:2,
})

 

 

Edit:

I was having some problems with your codesandbox example, so here is that example over on stackblitz instead.

 

https://stackblitz.com/edit/vue-txqcpg

 

As already mentioned, I'm not very familiar with Vue, soI took the idea for how to include ScrollTrigger in there from this codepen example. Maybe it will help.

 

See the Pen BajexOQ by GreenSock (@GreenSock) on CodePen

 

Oh, and the image up top was causing the trigger not to be where expected (probably as it is not loaded yet when the ScrollTrigger gets created), so I added fixed dimensions to it, to make it work properly.

Just something you might want to consider with regard to ScrollTrigger.

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...