I'm sure there is an easy solution, but I am missing it at the moment. Basicly I want to have three or four different divs that put their top location based on the bottom of the last div. So if someone resized the window and made it less wide then the top div would become taller and so the div below would need to move down some. I tried
The only time it works is if I specifically give bottom or height a number value and not a % value, but I want all the divs to have % values so that they can adjust based on the size of the screen the user is using and not based on the size of the screen I tested it on.
var TextDiv = document.getElementById("text");
var LinkDiv = document.getElementById("stringlink");
LinkDiv.style.top = TextDiv.style.bottom;
// I also tried
LinkDiv.sytle.top = TextDiv.style.top + TextDiv.style.height;
window.onload = Resize();
window.onresize = Resize();
Thanks again for your time.
Use only CSS with a div without width (or 100%) and the three following with a class
so in other words there is no way to circumvent the problem?
I found the problem.
returns a string with px appended to it. So to do arithmatic with two such variables you would end up with an appended string looking like
var x = Text.style.top;
Trying to give that to a style value obviously breaks the code. I still haven't found out how to get the value of the height if it is based on a % width and the window resizes.
Use offsetTop or offsetLeft (see for example this page) which are read only and give numbers.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)