Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Last active September 28, 2023 08:42
Show Gist options
  • Save phenomnomnominal/ac3f6fedbcb52f246ca4 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/ac3f6fedbcb52f246ca4 to your computer and use it in GitHub Desktop.
if (navigator.getBattery) {
navigator.getBattery().then((battery) => {
if (battery && battery.level < 0.2) {
let disableAnimations = document.createElement('style');
disableAnimations.type = 'text/css';
disableAnimations.innerHTML = `
* {
transition-property: none !important;
animation: none !important;
}
`;
document.querySelector('head').appendChild(disableAnimations);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment