Skip to content

Instantly share code, notes, and snippets.

@gavinblair
Created June 15, 2010 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gavinblair/439360 to your computer and use it in GitHub Desktop.
Save gavinblair/439360 to your computer and use it in GitHub Desktop.
Functions to make plain old Javascript easier to use, without a framework
//How can we make this one work with classes and tags?
function $(id){
return document.getElementById(id);
}
function html(id, html){ $(id).innerHTML = html; }
function css(id, style){ $(id).style.cssText += ';'+style; }
//iPhone/iPad/iPod browser animations
function anim(id, transform, opacity, dur){
css(id, '-webkit-transition:-webkit-transform'+
',opacity '+(dur||0.5)+'s,'+(dur||0.5)+'s;-webkit-transform:'+
transform+';opacity:'+(1||opacity));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment