feat(Swipe): pause autoplay when page hidden
This commit is contained in:
@@ -12,6 +12,7 @@ export default createComponent({
|
||||
TouchMixin,
|
||||
BindEventMixin(function(bind, isBind) {
|
||||
bind(window, 'resize', this.resize, true);
|
||||
bind(window, 'visibilitychange', this.onVisibilityChange);
|
||||
|
||||
if (isBind) {
|
||||
this.initialize();
|
||||
@@ -165,6 +166,14 @@ export default createComponent({
|
||||
this.initialize(this.activeIndicator);
|
||||
},
|
||||
|
||||
onVisibilityChange() {
|
||||
if (document.hidden) {
|
||||
this.clear();
|
||||
} else {
|
||||
this.autoPlay();
|
||||
}
|
||||
},
|
||||
|
||||
onTouchStart(event) {
|
||||
if (!this.touchable) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user