With the whenVisible modifier you can write:
<section data-action="addClass#bg-red-500:whenVisible">
I will be red once in view
</section>
Works the same for all other actions. It would be nice if the modifier was “boolean-aware”, e.g. remove the bg-red-500 class when not in visible, maybe using toggleClass#bg-red-500:whenVisible.
With above, I am leaning towards to remove the intersection altogether with the v1 version.
With the
whenVisiblemodifier you can write:Works the same for all other actions. It would be nice if the modifier was “boolean-aware”, e.g. remove the
bg-red-500class when not in visible, maybe usingtoggleClass#bg-red-500:whenVisible.With above, I am leaning towards to remove the intersection altogether with the v1 version.