Looking to change the body background using a jQuery script. The goal is to scale the background image to fit the browser window size. I've come across a script called , but it seems to affect the class img and not the background-img.
Any suggestions or ideas on how to achieve this?
<script type="text/javascript>
$(document).ready(function() {
$("#BGSelector a").click(function() {
var imgLink = $("img", this).attr("src");
$.cookie("html_img", "" + imgLink + "", { path: '', expires: 7 });
var imgCookieLink = $.cookie("html_img");
$("body").css("background", "url('" + imgCookieLink + "') no-repeat fixed center top #343837");
});
});
</script>
<script type="text/javascript>
$(document).ready(function() {
var imgCookieLink = $.cookie("html_img");
$("body").css("background", "url('" + imgCookieLink + "') no-repeat fixed center top #343837");
});
</script>