Resizer JS

Uniform's Resizer takes an element, and toggles classes that trigger Uniform's breakpoint scope utility based on that elements size instead of the window size.

<div id="example">
    <div class="sm:bg-green">
        stuff
    </div>
</div>
import {Resizer} from 'uniform';
new Resizer({
    el: document.getElementById('example')
})

Example

<div style="width: 730px" class="sm:bg-blue bg-yellow"></div>
<div style="width: 400px" class="sm:bg-blue bg-yellow"></div>