Skip to content

Instantly share code, notes, and snippets.

@AlphaNerd
Created June 1, 2015 14:48
Show Gist options
  • Save AlphaNerd/2a7b152b21e6b012dcec to your computer and use it in GitHub Desktop.
Save AlphaNerd/2a7b152b21e6b012dcec to your computer and use it in GitHub Desktop.
Basic header image swap script. Select target graphic and destination using CSS selectors.
var target = ".target div img";
var dest = "#header_img";
var link = jQuery(target).attr("src");
console.log(link);
jQuery(dest).css("backgroundImage","url('+link+')");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment