JSFiddle - React, Tailwind, and code Playground

by jscheel

HTML

<button>run</button>

<div>a</div>
<div>b</div>
<div>c</div>
<div>d</div>
<div>e</div>
<div>f</div>
<div>g</div>
<div>h</div>
<div>i</div>
<div>j</div>
<div>k</div>
<div>l</div>
<div>m</div>
<div>n</div>
<div>o</div>
<div>p</div>
<div>q</div>
<div>r</div>
<div>s</div>
<div>t</div>
<div>u</div>
<div>v</div>
<div>w</div>
<div>x</div>
<div>y</div>
<div>z</div>

CSS

div {
    width: 100px;
    height: 100px;    
    position: absolute;
    display: none;
}

JavaScript

$(document).ready(function(){
    $('button').on('click', function(){
        $('div').each(function(){
            $(this).position({
                my: 'left top',
                at: "left bottom",
                of: $(this).prev(),
                collision: 'none'
            });
        });
        console.log('done');
    });
});