Skip to content

Instantly share code, notes, and snippets.

@KarlHerler
Created April 13, 2011 11:39
Show Gist options
  • Save KarlHerler/917390 to your computer and use it in GitHub Desktop.
Save KarlHerler/917390 to your computer and use it in GitHub Desktop.
computes relative bg size to factual 100% even at relative sizes.
$(this).attr('backround-size', (10000/parseInt($("this").width())+"%"));
//or
function bgsize(width) { return 10000/width; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment