Do not verbose code:
WN: (function () {var el = $ (' <fakeelement> '), transition= "transition", transitionend,
animevent={' start ': null, ' iteration ': null, ' END ': null}, Vendorprefix;
Transition = Transition.charat (0). toUpperCase () + transition.substr (1);
vendorprefix= (function () {//Now opera is also Webkit var i=0, vendor=["Moz", "Webkit", "khtml", "O", "MS"]; while (I < vendor.length) {if (typeof El.css (vendor[i) + transition) = = = "string") {return Vendo
R[i];
} i++;
return false;
})();
Transitionend= (function () {var transendeventnames = {webkittransition: ' Webkittransitionend ', Moztransition: ' Transitionend ', otransition: ' Otransitionend otransitionend ', Transition: '
Transitionend '} for (var name in transendeventnames) {if (typeof el.css (name) = = "string") { REturn Transendeventnames[name];
}
}
})(); Animevent.end= (function () {var animendeventnames = {webkitanimation: ' Webkitanimationend ', a Nimation: ' Animationend '} for (var name in animendeventnames) {if (typeof el.css (name) = = "St
Ring ") {return animendeventnames[name];
}
}
})(); animevent.iteration= (function () {var animiterationeventnames = {webkitanimation: ' Webkitanimationitera
tion ', Animation: ' Animationiteration '} for (var name in animiterationeventnames) {
if (typeof el.css (name) = = "string") {return animiterationeventnames[name];
}
}
})();
animevent.start= (function () {var animstarteventnames = {webkitanimation: ' Webkitanimationstart ', Animation: ' Animationstart '} for (var name in AnimstaRteventnames) {if (typeof el.css (name) = = "string") {return animstarteventnames[name];
}
}
})();
return {called:false, addtranevent:function (elem,fn,duration) {var self = this;
var fncallback = function () {if (!self.called) {fn ();
Self.called = true;
}
}; function Hand () {Elem.on (Transitionend,function () {//elem.unbind Transitionend,arguments.calle
e);
Fncallback ();
});
} settimeout (Hand,duration);
}, Addanimevent:function (ELEM,NAME,FN) {elem.on (ANIMEVENT[NAME],FN);
}, Removeanimevent:function (ELEM,NAME,FN) {elem.unbind (ANIMEVENT[NAME],FN);
}, Setstyleattribute:function (Elem,val) {if (Object.prototype.toString.call (val) = = "[Object Object]") { for (var nameIn Val) {if (/^transition|animation|transform/.test (name)) {var stylename=name.charat (0). Toup
Percase () + name.substr (1);
Elem.css (Vendorprefix+stylename,val[name]);
}else{elem.css (Name,val[name]);
}
}
}
}
}; })(),
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.