Window.onresize triggers multiple times

window.onresize triggers multiple times

my browser is 5 pixels tall and onresize executes 5 times. The page wobbles badly. Is there any way to expand 5 pixels at the same time and execute onresize

only once?
window.onresize = () => {

}
Jun.10,2022

with the help of function anti-shake, you can introduce lodash


    // 
    var timeout;
    var dom_arr = $(".item_box");
    $(window).scroll(function(){
        if (timeout){
            clearTimeout(timeout);
        }   
        timeout = setTimeout(function(){   
            nav_add_on(dom_arr)  
        },200);   
    })
Menu