// this is for site-navigation with more sub ul-blocks.// in css root{--ul-hover-height:100px} //fallbackvalue // in css: nav ul ul:hover{height:--ul-hover-height;}// to make it dynamic using JS: // set variable ul ul height depending on nr. of li's:functionsetUlHeight(elem){
parentHeight=window.getComputedStyle(elem.parentNode).height
parentHeight=parseInt(parentHeight)*1.2//to cover li padding/margin..
elemHeight=parentHeight * elem.childElementCountlet root =document.documentElement;
root.style.setProperty('--ul-hover-height', elemHeight);}
// this is for site-navigation with more sub ul-blocks.// in css root{--ul-hover-height:100px} //fallbackvalue // in css: nav ul ul:hover{height:--ul-hover-height;}// to make it dynamic using JS: // set variable ul ul height depending on nr. of li's:functionsetUlHeight(elem){
parentHeight=window.getComputedStyle(elem.parentNode).height
parentHeight=parseInt(parentHeight)*1.2//to cover li padding/margin..
elemHeight=parentHeight * elem.childElementCount