4 ms·
Couple improvements to some of the modern-browser code examples: FadeIn: element.style.transition = 'opacity 400ms ease-in-out'; element.style.opacity = 1
by nostrademons 13y ago
Couple improvements to some of the modern-browser code examples:
FadeIn:
element.style.transition = 'opacity 400ms ease-in-out';
element.style.opacity = 1;
Each & filter (this also applies to people's complaints about browser methods not working on collections):
[].forEach.call(document.querySelectorAll(selector), function(el) { ... })
The native versions also usually run several times faster than the JQuery versions, which is the main reason to use them. This meme that you can't build performant, jank-free HTML5 mobile apps? It's largely because of JS libraries and developers that don't know which operations are fast and which are slow.
I'll also plug my colleague's autogenerated index of the HTML5 APIs:
http://html5index.org/ http://html5index.org/
- leobelle 13y agoI've had pretty terrible performance with complicated CSS animations that I managed to clear up with switching to JavaScript and requestAnimationFrame
- nostrademons 13y agoAre you animating the transform/opacity properties and only those? That's the general secret to smooth animations on web - they're GPU accelerated, everything else requires a call into the browser's layout engine on every frame.
- gisenberg 13y agoTransitions didn't end up being supported until IE10, which wouldn't jive with the IE8+ baseline the site proposes.