Add prefers-reduced-motion support

This commit is contained in:
David 2023-07-20 16:14:36 -07:00
parent 42ffce97d6
commit e0a6418e91

View file

@ -12,12 +12,16 @@ const StillImage = {
data () {
return {
stopGifs: this.$store.getters.mergedConfig.stopGifs,
isAnimated: false
isAnimated: false,
prefersReducedMotion: false
}
},
created () {
this.prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches
},
computed: {
animated () {
return this.stopGifs && this.isAnimated
return this.stopGifs && this.isAnimated && this.prefersReducedMotion
},
style () {
const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str