Answer the question
In order to leave comments, you need to log in
Are there any instances of JavaScript/jQuery calculation miscalculations?
Greetings
Yesterday was spent all day. The site page has an H1 heading right after it, JS was inserted that determines its height, but its height was not always determined correctly - the further the script was inserted into the HTML structure, the more often it worked correctly (correctly determined the height), but still there were cases of incorrect triggering. I decided to try jQuery - I placed the file before the closing BODY tag and did not rejoice for long, refreshed the page several times and still saw the same result - the height does not match the display on the screen. The pod added $(window).load(...) and tried it a hundred times - everything is correctly determined.
I even tried to determine the width, but it is not always correctly determined, even if the title is placed on one line.
var myTitle = document.querySelector('.title').offsetHeight;
console.log(myTitle);
console.log($('.title').height());
Answer the question
In order to leave comments, you need to log in
A custom font is used that is not loaded/rendered at the time of the first measurements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question