chicago
Version:
A front-end JavaScript library for user-interface developers.
92 lines (84 loc) • 2.51 kB
JavaScript
// @name: Chicago.support
// @description: Provides cross-browser support and uniform functions
// @since: 1.0.0-beta
_c.support = _c.$.extend(_c.support, {
requestAnimationFrame : win.requestAnimationFrame ||
win.webkitRequestAnimationFrame ||
win.mozRequestAnimationFrame ||
win.msRequestAnimationFrame ||
win.oRequestAnimationFrame ||
function(callback) {
win.setTimeout(callback, 1e3 / 60);
},
touch : 'ontouchstart' in win ||
win.DocumentTouch && win.document instanceof win.DocumentTouch ||
win.navigator.msPointerEnabled && win.navigator.msMaxTouchPoints > 0 ||
win.navigator.pointerEnabled && win.navigator.maxTouchPoints > 0 ||
false,
mutationobserver : win.MutationObserver ||
win.WebKitMutationObserver ||
null,
transition : {
end : (function() {
var ele = doc.body || doc.documentElement,
eventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend',
};
for( var name in eventNames ) {
if( ele.style[name] !== undefined ) {
return eventNames[name];
}
}
})()
},
animation : {
start : (function() {
var ele = doc.body || doc.documentElement,
eventNames = {
WebkitAnimation : 'webkitAnimationStart',
MozAnimation : 'animationstart',
OAnimation : 'oAnimationStart oanimationstart',
MSAnimation : 'MSAnimationStart',
animation : 'animationstart',
};
for( var name in eventNames ) {
if( ele.style[name] !== undefined ) {
return eventNames[name];
}
}
})(),
iteration : (function() {
var ele = doc.body || doc.documentElement,
eventNames = {
WebkitAnimation : 'webkitAnimationIteration',
MozTransition : 'animationiteration',
OTransition : 'oAnimationIteration oanimationiteration',
MSAnimation : 'MSAnimationIteration',
transition : 'animationiteration',
};
for( var name in eventNames ) {
if( ele.style[name] !== undefined ) {
return eventNames[name];
}
}
})(),
end : (function() {
var ele = doc.body || doc.documentElement,
eventNames = {
WebkitAnimation : 'webkitAnimationEnd',
MozAnimation : 'animationend',
OAnimation : 'oAnimationEnd oanimationend',
MSAnimation : 'MSAnimationEnd',
transition : 'animationend',
};
for( var name in eventNames ) {
if( ele.style[name] !== undefined ) {
return eventNames[name];
}
}
})()
}
});