4 ms·
'guess' indeed, it probably doesn't take long to run into a situation where you have to go back to regular JS. I'm confident the examples given can be simplifi
by Cthulhu_ 6y ago
'guess' indeed, it probably doesn't take long to run into a situation where you have to go back to regular JS.
I'm confident the examples given can be simplified as well. The vanilla JS and jQuery examples are not equivalent for example, the vanilla one is (intentionally?) inline JS whereas the jquery one separates it out.
It also doesn't use ES6 arrow functions (neither vanilla nor native), which would remove the need to rebind `this` to `self`.
The vanilla one also sets style via JS, which isn't how you should do things. Transitions can be set in CSS beforehand. The one used sets the animation to 'all' properties as well, instead of just 'opacity' which is the only property changed.
TL;DR the article is making vanilla look more difficult than it is. The jquery example seems lifted off of Stack Overflow.