解决resize执行多次

        var resizeTimer = null;
        window.onresize = function () {
            if (resizeTimer) clearTimeout(resizeTimer);
            resizeTimer = setTimeout(function () {
                console.log("窗口发生改变了哟!");
                car1.resize()
                car2.resize()
            }, 30);            
        }

 

posted @ 2020-07-15 10:17  五环  阅读(428)  评论(0编辑  收藏  举报