Created
June 21, 2011 00:23
-
-
Save vladocar/1036950 to your computer and use it in GitHub Desktop.
picoCSS Framework and Multi extend pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var selector = { | |
select: function (selector) { | |
this.value = Array.prototype.slice.call(document.querySelectorAll(selector)); | |
return this; | |
} | |
}; | |
var loop = { | |
each: [].forEach, | |
map: [].map | |
}; | |
var css = { | |
css: function (v) { | |
this.value = this.each.call(this.value, function (i) { | |
i.style.cssText = v; | |
}); | |
return this; | |
}, | |
att: function (a, v) { | |
this.value = this.each.call(this.value, function (i) { | |
i.setAttribute(a, v); | |
}); | |
return this; | |
} | |
}; | |
var animation = { | |
animate: function (time, scale, rotate, rotateX, rotateY, translateX, translateY, skewX, skewY) { | |
this.value = [].forEach.call(this.value, function (i) { | |
i.style.cssText = '-webkit-transition: all ' + time + 's ease-in-out; -webkit-transform: scale(' + scale + ') rotate(' + rotate + 'deg) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg) translate(' + translateX + 'px, ' + translateY + 'px) skew(' + skewX + 'deg, ' + skewY + 'deg)'; | |
}); | |
return this; | |
} | |
}; | |
var events = { | |
on: function (type, fn) { | |
this.value = this.each.call(this.value, function (i) { | |
i.addEventListener(type, fn, false); | |
}); | |
return this; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment