Jquery or pure JS + CSS3?

Asked

Viewed 566 times

1

The CSS3 gained so many utilities that before were only possible with programming, for example: Media queries, fb, keyframe, Transition etc...

So what are the advantages, disadvantages and when should I use?

  • 3

    You could edit and improve your question?

  • jQuery is Javascript. Everything you do with jQuery can be done with pure JS, use it or not go from the experience and practicality that each one wants. And CSS3 does not imply conflict between jQuery or pure JS, it is another tool for another purpose and it can be used with both.

  • People usually use only jQuery to make a simple animation or something like that. My suggestion is to use CSS3 + class exchanges with pure JS. Because only jQuery weighs much more. It’s like someone who only eats in fastfood: it kills hunger only that it weighs in health, say.

2 answers

2


You should use CSS whenever possible. The only impediment you can/should have is because of old browsers that may not support modern features.

CSS3 and its features are already part of the browser software that means intewrpretar CSS is faster to process, no need to read/parse Javascript to make a fade in for example, this is very useful. Rendering is faster and you don’t need to download as many Kb.

  • 1

    You always have the best answers :)

1

I consider using them all.

For example, in a single file .js i mix pure Javascript and jQuery in another .css I benefit from the control I can have over the style of each element in a more organized way.

Another example is the creation of animations. In CSS, animations like fadeOut are less practical than in jQuery. As for styling (colors, sizes, filters, etc.), in my opinion, CSS is the best choice.

When it comes to jQuery and pure JS, the first has the reputation of being more practical because of its simple syntax, but for calling functions I always opt for the old JS, because I feel more comfortable using function calls like minhaFuncao() in whatever part you want in HTML, or in onclick, onload, etc..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.