Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Sami Barasi

easing Back

Recommended Posts

Hello Greensock Team,

 

I've a conflict with a customer script and the greensock lib. This conflict has something to do with the "Back" function. If I rename this function to "Back2" I don't get an error. I made a codepen to demonstrate it. 

 

 

Regards,

Sami

See the Pen rVmpzK by kostjanix (@kostjanix) on CodePen

Link to comment
Share on other sites

I don't know what your script does, but try switching the order.

 

See the Pen gpWvYm by osublake (@osublake) on CodePen

  • Like 1
Link to comment
Share on other sites

Switching the order is unfortunately not a solution, because it's not my site. What ever that script does, it shouldn't matter while loading the greensock lib especially if I set the GreenSockGlobals option. I want to use Greensock for animating banners. For this I need to be sure not to interfere with scripts of any hosting sites and I also don't have the control of when or where my banners are loaded.

Link to comment
Share on other sites

GSAP was built to be compatible with several different types of component systems like requirejs, AMD, and node. In order to do that, it looks for a "define()" function that's an industry standard for AMD/CommonJS systems and if it finds one (and as long as it has an "amd" property defined), GSAP will register/define its classes through that function. In your case, it looks like you had a script that created a define function and also had a "Back" class already registered, so when GSAP tried to register its "Back", an error was thrown. So it's not really a bug in GSAP or anything - it's just a consequence of another script having the define() function and already registering a "Back" module. 

 

To avoid the problem, you can simply reassign the "define" variable to null right before GSAP loads, and then assign it back to what it was after GSAP loads. Here's a corrected pen: 

http://codepen.io/anon/pen/WvjqBQ

 

Does that help?

  • Like 2
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.
×