Skip to content

Commit

Permalink
Merge 359f562 into 66e811d
Browse files Browse the repository at this point in the history
  • Loading branch information
recherst committed Aug 24, 2017
2 parents 66e811d + 359f562 commit d97fec3
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/mixins/autoplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ const autoplay = {
},
destroyed () {
if (!this.$isServer) {
this.$el.removeEventListener('mouseenter', this.pauseAutoplay)
this.$el.removeEventListener('mouseleave', this.startAutoplay)
if ('ontouchstart' in window) {
this.$el.removeEventListener('touchstart', this.pauseAutoplay)
this.$el.removeEventListener('touchend', this.startAutoplay)
} else {
this.$el.removeEventListener('mouseenter', this.pauseAutoplay)
this.$el.removeEventListener('mouseleave', this.startAutoplay)
}

}
},
methods: {
Expand All @@ -49,8 +55,13 @@ const autoplay = {
},
mounted () {
if (!this.$isServer && this.autoplayHoverPause) {
this.$el.addEventListener('mouseenter', this.pauseAutoplay)
this.$el.addEventListener('mouseleave', this.startAutoplay)
if ('ontouchstart' in window) {
this.$el.removeEventListener('touchstart', this.pauseAutoplay)
this.$el.removeEventListener('touchend', this.startAutoplay)
} else {
this.$el.addEventListener('mouseenter', this.pauseAutoplay)
this.$el.addEventListener('mouseleave', this.startAutoplay)
}
}

this.startAutoplay()
Expand Down

0 comments on commit d97fec3

Please sign in to comment.