Hey everyone, I was hoping someone could assist me in find how I could find the offset bottom position of a div. I need the position to set the height of a "filler" div. Depending on the screen size of the user there is a large white space I would like to fill with the "filler" div. I was going to set the height of the "filler" div to the window.document.innerHeight - div offset bottom - footer size. Is this even possible?
You can use this code function calcNodePos(oNode) { var yPos = oNode.offsetHeight; do { yPos+= oNode.offsetTop; oNode = oNode.offsetParent; }while( oNode ); return yPos; } Code (markup): oNode is the DIV element: oNode = document.getElementById("Div_Id"); Code (markup): but I would recommend to go with CSS. JavaScript is not needed here.
you can use this code function calcNodePos(oNode) { var yPos = oNode.offsetHeight; do { yPos+= oNode.offsetTop; oNode = oNode.offsetParent; } while( oNode ); return yPos; }
You can add an event listener to check if the window is resized, and resize the filler div accordingly...