Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery加载和调整大小时最高子级的父级高度_Jquery_Wordpress_Height_Equals - Fatal编程技术网

jQuery加载和调整大小时最高子级的父级高度

jQuery加载和调整大小时最高子级的父级高度,jquery,wordpress,height,equals,Jquery,Wordpress,Height,Equals,我正在试着得到一个ul(ul.认证),它的高度等于加载和调整窗口大小时最高的孩子李的高度。一个潜在的问题是,lis是绝对DIV,并且使用查询周期分阶段使用。我正在通过Wordpress加载is脚本,但它似乎不起作用:- <script> function equalHeight(group) { tallest = 0; group.each(function() { thisHeight = $(this).height(); if(thisHeight >

我正在试着得到一个ul(ul.认证),它的高度等于加载和调整窗口大小时最高的孩子李的高度。一个潜在的问题是,lis是绝对DIV,并且使用查询周期分阶段使用。我正在通过Wordpress加载is脚本,但它似乎不起作用:-

<script>
function equalHeight(group) {
tallest = 0;
group.each(function() {
    thisHeight = $(this).height();
    if(thisHeight > tallest) {
        tallest = thisHeight;
    }
});
group.height(tallest);
}

jQuery(function($){
$(window).on('load', function(){
equalHeight($("ul.testimonial"));
});
 });

 $(window).bind('resize', function () { 
//$('ul.testimonial').css('height','auto');
equalHeight($("ul.testimonial"));
});
</script>

功能相等高度(组){
最高=0;
组。每个(函数(){
thisHeight=$(this).height();
如果(此高度>最高){
最高=此高度;
}
});
身高(最高);
}
jQuery(函数($){
$(窗口).on('load',function(){
等高(美元);;
});
});
$(窗口).bind('resize',函数(){
//$('ul.commential').css('height','auto');
等高(美元);;
});
有人能告诉我代码出了什么问题,或者是更好的方法吗

谢谢


Glennyboy

我发现这个代码最终对我有效。我相信有更好的,但它是相当小的,jt确实工作

<script type="text/javascript">
jQuery(document).ready(updateHolderSize);
jQuery(window).resize(updateHolderSize);

function updateHolderSize() {
var max = 0;
jQuery("ul.testimonial li").each(function () {
    max = Math.max(max, jQuery(this).height());
});
jQuery("ul.testimonial").height(max);
}
</script>

jQuery(document).ready(updateHolderSize);
jQuery(窗口).resize(updateHolderSize);
函数updateHolderSize(){
var max=0;
jQuery(“ul.证明文件”)。每个(功能){
max=Math.max(max,jQuery(this.height());
});
jQuery(“ul认证”)。高度(最大值);
}
对于我在Wordpress中的实现,这只适用于“jQuery”而不是“$”

干杯
Glennyboy

将$work包装到
jQuery(函数($){/*使用$here*/})