Skip to content

Instantly share code, notes, and snippets.

@vladocar
Created June 21, 2011 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladocar/1036950 to your computer and use it in GitHub Desktop.
Save vladocar/1036950 to your computer and use it in GitHub Desktop.
picoCSS Framework and Multi extend pattern
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