Skip to content

Commit 401e07b

Browse files
author
zhangxinxu
committed
fixed a bug in Safari
animationstart, animationend events will not be triggered in Safari, isWebkit judge error. Because it don't support document.webkitHidden.
1 parent 2437ddc commit 401e07b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mobilebone.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,19 @@
200200
}
201201

202202
// do callback when animation start/end
203-
var isWebkit = typeof document.webkitHidden != "undefined";
203+
var isWebkit = 'WebkitAppearance' in document.documentElement.style || typeof document.webkitHidden != "undefined";
204204
["animationstart", "animationend"].forEach(function(animationkey, index) {
205205
var animition = params_in[animationkey], webkitkey = "webkit" + animationkey.replace(/^a|s|e/g, function(matchs) {
206206
return matchs.toUpperCase();
207207
});
208-
209208
if (!store[pageid]) {
209+
var animateEventName = isWebkit? webkitkey: animationkey;
210210
if (typeof animition == "string" && params_in.root[animition]) {
211-
pageInto.addEventListener(isWebkit? webkitkey: animationkey, function() {
211+
pageInto.addEventListener(animateEventName, function() {
212212
params_in.root[animition](this, this.classList.contains("in")? "into": "out");
213213
});
214214
} else if (typeof animition == "function") {
215-
pageInto.addEventListener(isWebkit? webkitkey: animationkey, function() {
215+
pageInto.addEventListener(animateEventName, function() {
216216
animition(this, this.classList.contains("in")? "into": "out");
217217
});
218218
}

0 commit comments

Comments
 (0)