Answer the question
In order to leave comments, you need to log in
Why does the code not work correctly in safari?
I wrote the code, it works correctly in all browsers available to me, even on an iPhone in safari. But here on the desktop does not want to. The code compares the rows of the two tables and sets the height of the larger row. In safari, the code works, but it takes it crookedly and counts incomprehensible numbers.
the code itself
$(document).ready(function() {
function recalcHeight(){
$(".titles tr").each(function(){
var height_title = $(this).height();
var index_title = $(this).index();
var height_value = $(".values tr").eq(index_title).height();
console.log("высота "+index_title+"й строки левой таблицы равна - "+height_title+"px");
console.log("высота "+index_title+"й строки правой таблицы равна - "+height_value+"px");
if(height_title <= height_value){
$(this).css("height", height_value);
}else{
$(".values tr").eq(index_title).css("height", height_title);
}
});
}
recalcHeight();
$(window).resize(function() {
recalcHeight();
});
});
Answer the question
In order to leave comments, you need to log in
found a jamb, dom loaded faster than pictures in the table, respectively, the lines were considered without the height of the picture, replaced
with
this solved the problem
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question