Skip to content

Commit 163882a

Browse files
committed
skip css transitions if page is not visible
1 parent 2d3cf2d commit 163882a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/transition/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var _ = require('../util')
22
var applyCSSTransition = require('./css')
33
var applyJSTransition = require('./js')
4+
var doc = typeof document === 'undefined' ? null : document
45

56
/**
67
* Append with transition.
@@ -134,7 +135,15 @@ var apply = exports.apply = function (el, direction, op, vm, cb) {
134135
vm,
135136
cb
136137
)
137-
} else if (_.transitionEndEvent) {
138+
} else if (
139+
_.transitionEndEvent &&
140+
// skip CSS transitions if page is not visible -
141+
// this solves the issue of transitionend events not
142+
// firing until the page is visible again.
143+
// pageVisibility API is supported in IE10+, same as
144+
// CSS transitions.
145+
!(doc && doc.hidden)
146+
) {
138147
// css
139148
applyCSSTransition(
140149
el,

0 commit comments

Comments
 (0)