Cool solution, it helped me, thank you! In addition I've improved this approach with some debounce mechanism (setTimeout) that will limit count of function executions.
lettimeoutId=null;constdocumentHeight=()=>{clearTimeout(timeoutId);// avoid execution of previous timeoutstimeoutId=setTimeout(()=>{constdoc=document.documentElement;doc.style.setProperty('--doc-height',`${window.innerHeight}px`)},200);};window.addEventListener(‘resize’,documentHeight);documentHeight();
Exploring the new tools and techniques on frontend development. Loves to meet up with new people and participate in the community. I do interesting stuff on codepen https://codepen.io/nirazanbasnet
Cool solution, it helped me, thank you! In addition I've improved this approach with some debounce mechanism (setTimeout) that will limit count of function executions.
Tankyou !! Appreciated :)
Sometimes debouncing cost more then running the code itself. Just as an FYI.