Jump to content
Search Community

Adapting Observer to Trigger Click Events

pietM test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

  • Solution

First of I would not trigger a click event on something else that then in turn does some logic. I would recommend abstracting out the thing you want to happen and then make the click event and the Observer use that abstracted out function. 

 

If you haven't worked yet with the Observer plugin, it fires a lot of times when you just use it as is. It is a smart idea to build in a check if something is already happening and then preventing it from doing its thing. I've create a new variable isAnimating which is false and get set to true when it starts to animate, I've rewritten your prev and nexterPush to use an animations which sets isAnimating to false when it is done. 

 

Hope it helps and happy tweening! 

 

See the Pen dyLMvRz?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

  • 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...