I have a grid-system which can be 3 to 1 column wide. The boxes are always 320x320 sized. Each box has a class-name which determine its position in the grid, eg.
<div class="sp3-om sp2-4r sp1-6"></div>
.
One column is pure flexbox, eg. "sp1-6" has order: 6
.
To append an back-button i need to select the last box, which is :visible and has the highest order. I have tried multiple things like
$('.box').filter(function(){ return $(this).css('order') == 6 })
How can i select the last visible flexbox element, because .last() selects the last element in DOM, not the last one visible on the screen.