How to calculate the height of the first n elements (blocks) of a list using js / jquery?
Closed due to the fact that the essence of the question is incomprehensible by the participants Alexey Shimansky , Igor , Alex , user194374, cheops 3 Dec '16 at 6:31 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- oneWould you have at least some of his attempt showed. - Igor
|
1 answer
Option on jQuery
var heigthList = []; $('query').slice(0, 15).each(function(i) { heigthList.push($(this).height()); }); Option on Vanilla JS
var heigthList = []; var elements = document.querySelectorAll('query') Array.prototype.slice.call(elements, 0, 15).forEach(function(element) { heigthList.push(element.offsetHeight); }) |