JQuery selector for child of parent of previous brother
For each stat block, as shown below:
<div class="stats">
<div class="label">
<span class="goal">10 YEARS OF SOMETHING GOOD</span>
</div>
<div class="stat">
<div class="tri"></div>
</div>
</div>
I want to set marginRight tri
to half the width of the previous one goal
. What jQuery selector would I use to grab the previous “target” relative to each tri
?
Sort of..
$(function(){
$('.tri').css({marginRight: function() {
return Math.floor($(this).something('.goal').width() / 2) + 'px';
}})
})
+3