Answer the question
In order to leave comments, you need to log in
What happens to Safari when calculating height?
Found a strange feature of Safari, if you set the height of an element and then request it, then some magic happens:
$('.js--post-grid').height(400);
console.log($('.js--post-grid').first().height()); // = 0
console.log($('.js--post-grid').last().height()); // = 0
setTimeout(function(){
console.log($('.js--post-grid').first().height()); // = 23
},1);
setTimeout(function(){
console.log($('.js--post-grid').first().height()); // = 23
},2);
setTimeout(function(){
console.log($('.js--post-grid').first().height()); // = 23
},10);
setTimeout(function(){
console.log($('.js--post-grid').first().height()); // = 201
},100);
setTimeout(function(){
console.log($('.js--post-grid').first().height()); // = 400
},1000);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question