Add prefers-reduced-motion support

This commit is contained in:
David 2023-07-20 16:14:36 -07:00 committed by qbism
parent 2bd41dd19e
commit ad02237b6e

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