I wish to use JavaScript to apply the style given below to the body of the HTML or another div on mouseover. And reverse on mouseout. Both with a fade if possible?
Style:
.box-style_img2 {
background-image: url(img.png);
background-size: auto;
background-repeat: repeat;
background-attachment: scroll;
background-color: #00a0b0;
}
Thanks in advance. P.S. Just beginning to learn Javascript.
It is always better to do things in CSS if you can avoid Javascript
Try using
:hoverproperty of css. For animation usetransitionpropertyAlso you can check this fiddle