Steve
Steve

Reputation: 109

Should I use Greensock entirely instead of JQuery?

I am fully aware of the performance gain when I use Greensock. I want to use it. However, I am confused because I often use

1) JQuery if and else statements

2) JQuery addClass, toggleClass, removeClass

3) JQuery on Click

4) JQuery on Scroll

Can I do all this with Greensock or do I use both in combination? I searched but didnt find any answers online.

I would appreciate your advice.

Upvotes: 1

Views: 675

Answers (1)

Bangkokian
Bangkokian

Reputation: 6654

Greensock is specifically an animation platform. It's awesome at bascially two things: Tweening, and sequencing tweens.

Literally anything in the DOM, or any attribute can be tweened with Greensock.

But once you start getting into functionality, you're outside of Greensock's featureset. So then the question is, what's your preferred flavor of javascript? I use Greensock extensively with plain vanilla js to maximize speed. But there's no reason to not use Jquery if it helps you code faster.

Keep in mind:

1) Greensock and Jquery play very nicely together. There's no reason to not use TweenLite for your animation and if you're seeing performance gains, and Jquery for your logic.

2) It sounds like most of the functionality you're looking for is pretty basic. You might be okay without jQuery and just using plain old .js.

There are no right and wrong directions here. Both platforms play well with each other. And it doesn't sound like any of them is essential for your goals. Pick and choose from either one.

  • GS / Plain JS = okay
  • GS / Jquery = okay
  • Jquery alone = okay

Upvotes: 2

Related Questions