Can I use jQuery to set the width and height of a background image?
I'm just starting my first jQuery project (tutorial from this months Web Designer) and I've got a background image that I want to spread across the entire background, regardless of browser size. It's big, so I originally had an onload function. This works fine in Mozilla and Safari but not in IE.
My question is, can jQuery set a width and height of 100% and have it work in IE?
- <script type="text/javascript">
function setBackground(){
var elem = document.createElement("img");
elem.setAttribute("src", "wall.jpg");
elem.setAttribute("height", "100%");
elem.setAttribute("width", "100%");
document.body.appendChild(elem);
}
</script>