This is my CSS-code:
div.dropdown
{
width: 100%;
height: 130px;
background-color: white;
border: solid thin #666;
position:absolute;
font-size: 70px;
padding-top: 30px;
text-align:center;
top: calc(100% - 320px);
}
If I try to get the top-property in javascript using window.getComputedStyle(dropdown).top
, I get an empty value.
How can I get the top value?
I found out that if I set the top-property to calc(100%) (just for testing), the aforementioned method works well.
This is the javascript code:
function show_dropdown(dropdown_id, dropdown_menu_id)
{
var dropdown = document.getElementById(dropdown_id);
var menu = document.getElementById(dropdown_menu_id);
var menu_entries = Array.prototype.slice.call(menu.childNodes);
var dropdown_top = parseInt(window.getComputedStyle(dropdown).top);
...
}