在这里,我已完成上述问题的完整演示.请查看演示链接.
HTML:
Wood
Steel
Black metal
jQuery的:
$(function() {
$(".bgCollection").change(function() {
if ($("#wood").is(":checked")) {
$("body").css('backgroundImage', "url('http://cdnimg.visualizeus.com/thumbs/7f/78/gfx,wood-7f78592c9a6ed3390492c560c5ac6fec_h.jpg')");
}
if ($("#steel").is(":checked")) {
$("body").css('backgroundImage', "url('http://www.aroorsteelcorporation.com/full-images/stainless-steel-834007.jpg')");
}
if ($("#metal").is(":checked")) {
$("body").css('backgroundImage', "url('http://i00.i.aliimg.com/photo/v0/468538622/Brushed_metal_texture_prepainted_metal.jpg')");
}
});
});