Jump to content

Changing background image


Imoddedu

Recommended Posts

Does anybody know how I can change the background image of the body with jQuery? I've tried something like this but it doesn't seem to work:

$("#webDesignLink").hover(function() {				$('body').css('background', 'url(img/bgWeb.png)');			});

Link to comment
Share on other sites

Does that mean you're not going to try it?
Of course I am going to try it, I was just curious though.EDIT: It did not change, maybe it isn't supported?
Link to comment
Share on other sites

I guess you could do it either way, I personally would opt to target the property specifically.as mentioned before, is #webDesignLink a valid element? can you indeed confirm that the hover event is firing?

$("#webDesignLink").hover(function() {  console.log('webDesignLink hover');  $('body').css('background', 'url(img/bgWeb.png)');});

is your javascript in an external file? is the image path relative to the external file?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...