forked from AkkomaGang/akkoma-fe
Add prefers-reduced-motion support
This commit is contained in:
parent
42ffce97d6
commit
e0a6418e91
1 changed files with 6 additions and 2 deletions
|
@ -12,12 +12,16 @@ const StillImage = {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
stopGifs: this.$store.getters.mergedConfig.stopGifs,
|
stopGifs: this.$store.getters.mergedConfig.stopGifs,
|
||||||
isAnimated: false
|
isAnimated: false,
|
||||||
|
prefersReducedMotion: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created () {
|
||||||
|
this.prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
animated () {
|
animated () {
|
||||||
return this.stopGifs && this.isAnimated
|
return this.stopGifs && this.isAnimated && this.prefersReducedMotion
|
||||||
},
|
},
|
||||||
style () {
|
style () {
|
||||||
const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str
|
const appendPx = (str) => /\d$/.test(str) ? str + 'px' : str
|
||||||
|
|
Loading…
Reference in a new issue