I am working on a mobile first UI of an Angular project, where the div which is position: sticky needs to change its style, so how can I apply styling to the div only after it is stuck, without using jQuery, etc.
I've tried using https://developers.google.com/web/updates/2016/04/intersectionobserver but I am not able to mock that functionality
.title {
font-size: 16px;
color: black;
}
/*On being stuck*/
.title
/*::stuck*/
{
font-size: 18px;
background: grey;
}
<div style="height: 700px;">
<div class="title" style="position: sticky; position: -webkit-sticky; top: 20px;">
This div is to be styled on being 'stuck'
</div>
</div>