javascript - javascript中多个li的高度相同

标签 javascript height

我是 JavaScript 新手。如果我们刷新页面它工作正常,但当我们调整窗口大小时它不起作用。

$(window).load(function(){
    equl_height();
});

$(window).resize(function(){
    equl_height();
}); 


function equl_height () {
    var highestBox = 0;
    $('ul li').each(function(){  
        if($(this).height() > highestBox){  
            highestBox = $(this).height();  
        }
    });    
    $('ul li').height(highestBox);
}

最佳答案

window.addEventListener("resize", equl_heigh);

干杯!

关于javascript - javascript中多个li的高度相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35194079/

相关文章:

html - 如何在不影响表格单元格负边距的情况下使此 div 显示为 :table take the height of 80% of its parent,

javascript - 如何使 div 调整包含内容的高度?

javascript - Cubism 自己的数据源问题

javascript - 将原始类型和对象传递给 Controller ​​时的差异

javascript - 如何在选择选项中使用 'for each'?

html - 如何使用 Css 格式化文本框

css - 如何使div的高度与显示器的高度匹配

javascript如何运行相同的功能onLoad和onChange

javascript - 在 React.render() 中返回多个元素

html - 侧边栏高度等于主要内容高度