I’m currently using this code to change my page’s css3 background when you hover over a paragraph:
$(function(){
$('#web').hover( function(){
$('html').css('background', '#000 url("space-image.png") center center fixed no-repeat');
});
});
it works fine but I want to add fadIn to it so it will be smoother.
Also, I would like to fade the new background back to the old one when you are not hovering over the paragraph (#web).
You can easily accomplish this by using jQuery and jQuery UI and animate the classes instead of having to animate the individual attributes using SwitchClass.
jQuery:
Just set the style properties for oldClass and newClass in your CSS. (Renaming appropriately)
Make sure that you are loading the jQuery UI library:
Working example: http://jsfiddle.net/yPBVs/