Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get all the children top and left

I want to get all children offset top inside parent by using jquery and javascript but I only found a few ways to use loop and it’s very long so I believe there is something shorter for this

And i never actually learn jquery from A to Z so if it has any solution can you tell me ? Thanks

I want achieve some thing like

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

var top = $("#storage").children().each().offset().top;

And it will way more beautiful if it is already sorted to array by jquery something like

var top = [122,213,123];

>Solution :

You can use .map (and .get to convert to a regular array).

let top = $("#storage").children().map((_, el) => $(el).offset().top).get();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading