Skip to content

Instantly share code, notes, and snippets.

@replete
Created April 14, 2012 14:55
Show Gist options
  • Save replete/2384987 to your computer and use it in GitHub Desktop.
Save replete/2384987 to your computer and use it in GitHub Desktop.
Change <body> background url through data-attribute
/* -------------------------------------- */
//Body background
var $bodyBackground = $("[data-body-background]:eq(0)"),
backgroundURL = $bodyBackground.attr("data-body-background");
if ($bodyBackground.length > 0) {
$body
.css("background", "url(" + backgroundURL + ") no-repeat top center #000");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment