perf(core): ️ disable all CSS transition during window resize

This commit is contained in:
alistair3149 2024-10-19 00:13:13 -04:00
parent 1ca49e61cf
commit 10d3c17f18
No known key found for this signature in database

View file

@ -7,6 +7,16 @@
*/
function enableCssAnimations( document ) {
document.documentElement.classList.add( 'citizen-animations-ready' );
// Disable all CSS transition during resize
const onResize = () => {
document.documentElement.classList.remove( 'citizen-animations-ready' );
};
const onResizeEnd = mw.util.debounce( () => {
document.documentElement.classList.add( 'citizen-animations-ready' );
}, 250 );
window.addEventListener( 'resize', onResize );
window.addEventListener( 'resize', onResizeEnd );
}
/**