Jump to content
Search Community

jQuery and GSAP

Richard1604 test
Moderator Tag

Recommended Posts

Hello,

i have just started looking at Greensock and happily learning from all the examples that are out there while 

setting myself targets to reproduce or clone some excellent sites.

my first question is regarding jQuery and JavaScript 6.

it is obvious that jQuery now has a limited future and JavaScript is now much more mature so my question is should I still be using jQuery  or is there a respected book that covers how to transition from jQuery to JavaScript which focuses on the nitty gritty instead of aspects that i realistically will never need.

Link to comment
Share on other sites

Hey Richard and welcome to the GreenSock forums.

 

We like to keep these forums focused on GSAP, but I'm happy to answer in this case. 

 

jQuery is far from dying out. Admittedly it is not growing at the same rate as 2006-2016 but that doesn't mean that people don't use it. A lot of people still do.

 

I recommend that you be very comfortable writing JavaScript without jQuery but also learn some basics about using jQuery in case a client/company wants you to use it. I hardly ever use jQuery any longer but it's still important to understand and be able to write a little bit in some instances.

 

In terms of learning vanilla JS, it'd probably be better to read a book/go through a class on JavaScript than to try and fine one converting jQuery to regular JS. If you have specific questions of how to convert something in jQuery to vanilla JS, youmightnotneedjquery is a good resource.

  • Like 1
Link to comment
Share on other sites

I don't use jQuery for too many things, but it's handy when you need it. As Zach link shows, it's used a whole bunch and still trending upwards. 

QtT0LQU.png

It's not shiny and new, but it's a workhorse. I know some people who learned jQuery first and then vanilla as well as vice versa. I personally learned  GSAP syntax first and then dug deep into JavaScript and jQuery. Everyone has their own method of learning. Fortunately there is a massive collection of tutorials, videos and books available for all the training you'd need or want.

 

Best of luck on your journey.

:)  

  • Like 2
Link to comment
Share on other sites

thanks very much for this very helpful response.

I now take it that jQuery is not deprecated and I can happily use it without having to find a good resource that focuses on the every day grunt work of manipulating the DOM and listening for events!   

Link to comment
Share on other sites

3 minutes ago, Richard1604 said:

I now take it that jQuery is not deprecated and I can happily use it without having to find a good resource that focuses on the every day grunt work of manipulating the DOM and listening for events!   

Vanila JS is quite good at that sort of thing these days:

// plain JS
const boxes = document.querySelectorAll(".box");
// jQuery
const boxes = $(".box");

// plain JS version of jQuery's selector
const $ = param => document.querySelectorAll(param);
const boxes = $(".box"); // No jQuery required!

Same thing for events listening:

// jQuery
$myElem.on("click", myFunc);

// plain JS
myElem.addEventListener("click", myFunc);

 

  • Like 1
Link to comment
Share on other sites

¯\_(ツ)_/¯ There are plenty of resources for vanilla JS and many others for comparative conversions of common things concerning JQuery. It sounds like you are already using and familiar with JQuery? If so then I would set out learning the basics of vanilla JS if you already have the JQuery knowledge. Most times especially with GSAP there is no need to load an entire library like JQuery since GSAP itself internally handles selectors etc., and with most the other related code you will need vanilla JS is quite easy in most cases.

 

Yes you can still load and use JQuery but do you need to? You can do everything with vanilla JS now days. JQuery remains a solid library for its intended purpose but that purpose is no longer what it once was as Javascript has since matured IMHO. So I say bridge the gap now and move forward with vanilla JS especially if you already have the JQuery knowledge. Plus most CodePen examples and newer tutorials that you will find for GSAP 3 use vanilla JS.

 

@OSUblake will enjoy this JQuery thread. 😉

  • Like 1
Link to comment
Share on other sites

My personal opinion: jQuery is very rarely needed. You shouldn't feel any shame for using it, but I'd encourage you to try to get along without it because it's one less library to load (kb) and going without it will help you learn some useful techniques with the native JS API. You may find yourself feeling more empowered and confident as a developer after a while. 

 

Then again, if you're focused on learning other things (like GSAP), it makes perfect sense to press jQuery into service if that allows you to be more productive with your current learning endeavors. When I started in JS, I used jQuery a lot because I just didn't have time to learn all the stuff it was abstracting away for me at that time. Since then, I've wanted to tackle that stuff on my own. It's a process. 

 

So again, there's nothing "wrong" with using jQuery. We won't think any less of you for doing so :)

  • Like 2
Link to comment
Share on other sites

2 hours ago, ZachSaucier said:

jQuery is far from dying out. Admittedly it is not growing at the same rate as 2006-2016 but that doesn't mean that people don't use it. A lot of people still do.

 

I don't think those numbers are really representative of developers using jQuery. A lot of those stats are from site add-ons, like a mailchimp form or a wordpress theme.

 

47 minutes ago, Shrug ¯\_(ツ)_/¯ said:

So I say bridge the gap now and move forward with vanilla JS especially if you already have the JQuery knowledge. Plus most CodePen examples and newer tutorials that you will find for GSAP 3 use vanilla JS.

 

@OSUblake will enjoy this JQuery thread. 😉

 

So true. I think jQuery is a crutch and holds a lot of people back. 

 

  • Like 1
Link to comment
Share on other sites

Thanks all for your helpful comments and indulging my general non-specific question.

I've only been looking at GSAP for a couple of days and it is already coming together.

The API is very well documented and I am finding myself coming up with more and more creative ideas so at the moment the dominant thought is how to integrate and put all the different pieces together.

Perhaps not the easiest approach for you to answer but if i get my thoughts organised early then I feel that it will save both you and me lots of time!   

  • 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.
×
×
  • Create New...