码迷,mamicode.com
首页 > 其他好文 > 详细

2016/2/12 codes

时间:2016-02-12 23:20:46      阅读:349      评论:0      收藏:0      [点我收藏+]

标签:

var docElem = window.document.documentElement,
transEndEventNames = {
‘WebkitTransition‘:‘webkitTransitionEnd‘,
‘MozTransition‘:‘mozTransitionEnd‘,
‘OTransition‘:‘OTransitionEnd‘,
‘msTransition‘:‘msTransitionEnd‘,
‘transition‘:‘transitionEnd‘
},
transEventName = transEndEventNames[Modernizr,prefixed(‘transition‘)],
support = {
pointerevents:Modernizr.pointerevents,
csstransitions:Modernizr.csstransitions,
csstransform3d:Modernizr.csstransform3d
};
function scrollX(){
return window.pageXOffset || docElem.scrollLeft;
}
function scrollY(){
return window.pageYOffset || docElem.scrollTop;
}
function getViewportW(){
var client = docElem[‘clientWidth‘],
inner = window[‘innerWidth‘];
if(client < inner)
return inner;
else
return client;
}
function getViewportH(){
var client = docElem[‘clientWidth‘],
inner = window[‘innerHeight‘];
if(client < inner)
return inner;
else
return client;
}
function extend(a,b){
for(var key in b){
if(b.hasOwnProperty(key)){
a[key] = b[key];
}
}
return a;
}

/**************modernizr.custom.js(部分)*******************/

;window.Modernizr = function(a,b,c){
function z(a){j.cssText = a}
function A(a,b){return z(m.join(a + ":") + (b||""))}
function B(a,b){return typeof a == b}
function C(a,b){return !!~("" + a).indexOf(b)}
function D(a,b){
for(var d in a){
var e = a[d];
if(!c(e,"-")&&j[e]!== c)return b = "pfx"?e:!0
}
return !1;
}
function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}
function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");
return B(b,"string") || B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}
var d = "2.7.1",e = {},f = !0,g = b.documentElement,h = "modernizr",i = b.createElement(h),
j = i.style, k,I = {}.toString,m = "-webkit- -moz- -o- -ms-".split(""),
n = "Webkit Moz O ms",o = n.split(""),p = n.toLowerCase().split(""),q = {},r = {},s = {},t = [],u = t.slice.v,
w = function(a,c,d,e){var f, i, j, k,I = b.createElement("div"),m = b.body,n = m || b.createElement("body");
if(parseInt(d,10))while(d--)j = b.createElement("div"), j.id = id=e?e[d]:h+(d+1),l.appendChild(j);
return f = ["&#173",‘<style id = " s,‘h,‘">‘, a , ‘<style>‘].join(""),1.
id = h,(m?I:n).innerHTML += f, n.appendChild(I),m || (n.style.background = "",
n.style.overflow = "hidden",k = g.style.overflow, g.style.overflow = "hidden",
g.appendChild(n)),i = c(I,a),m? I.parentNode.removeChild(I);
(n.parentNode.removeChild(n), g.style.overflow = k),
!!i},x = {}.hasOwnProperty,
y;!B(x,"undefined") && !B(x.call,"undefined")?y = function(a,b){return x.call(a,b)};
y = function(a,b){return b in a && B(a.constructor.prototype[b],"undefined")},
Function.prototype.bind || (Function.prototype.bind = function (b){
var c = this;
if(typeof c!= "function")throw new TypeError;
var d = u.call(arguments,1),
e = function(){
if(this instanceof e){
var a = function(){};
a.prototype = c.prototype;
var f = new a,
g = c.apply(f,d.concat(u.call(arguments)));
return object(g) == g?g:f
}
return c.apply(b, d.concat(u.call(arguments)))
};
return e
}),
q.csstransforms3d = function(){
var a = !!F("perspective");
return a && "webkitPerspective" in g.style && w("@media(transform-3d)," +
"(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",
function(b,c){a = b.offsetLeft == 9 && b.offsetHeight == 3}),
a},
q.csstransitions = function(){return F("transition")};
for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));
}

2016/2/12 codes

标签:

原文地址:http://www.cnblogs.com/whatcanido/p/5187326.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!