Is it possible to get the space between two elements that use justify-content: space-between in a flexbox using JavaScript?
It's possible. Example
function calcSpaceBetween(){
var red_pos = $('#d1').position().left + $('#d1').width();
var blu_pos = $('#d2').position().left;
var space = blu_pos - red_pos;
$('#space').text(space + ' px')
}
Calculate the position of the left one (red) + it's width
Find the position of the right one (blue)
(blue.position) - (red) + (red.width)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With