I need my background image to be below my div menu. So instead of applying the background to the body element, I put in another bg div that contains my body div and sets the width to 100%. (My body has a specified width div). I set the background inside the bg div.
I tested it and I got half of the background image because the document was not long enough. Therefore, I am trying to make a javascript fix for this.
<!DOCTYPE HTML> ..... <script type="text/javascript" src="jquery-min.js"></script> <script type="text/javascript"> function setDocumentSize() { alert($(window).height()); alert($(document).height()); if ($(window).height()>$(document).height()) { var height = $(window).height()-$(document).height(); document.getElementById('bg').style.height=height+"px" } } ..... </script> ..... <body onload="setDocumentSize()"> <div class="menu"> ..... </div> <div class="bg"> <div class="body"> .....(background in this div) </div> </div>
Now both warnings appear with the height of the viewport. Therefore, nothing happens.
I am using Firefox 16.0.2
Here is the link to the actual page http://servapps.dyndns-work.com/abstract/
source share