Skip to content

Truly independent web browser

1011 B
Raw Blame
<!DOCTYPE html>
<link rel="match" href="../expected/position-sticky-nested-with-transform-ref.html" />
<style>
    .scrollable-container {
        width: 400px;
        height: 200px;
        overflow-y: scroll;
        border: 5px solid red;
    }

    .outer-sticky {
        position: sticky;
        top: 0px;
        width: 350px;
        height: 100px;
        background: #3498db;
        transform: translateX(20px);
    }

    .inner-sticky {
        position: sticky;
        top: 30px;
        width: 200px;
        height: 40px;
        background: #e74c3c;
    }

    .spacer {
        height: 300px;
        background-color: orange;
    }
</style>

<div class="scrollable-container" id="container">
    <div class="spacer"></div>
    <div class="outer-sticky">
        <div class="inner-sticky"></div>
    </div>
    <div class="spacer"></div>
</div>

<script>
    // Outer sticky has a transform, inner sticky is nested inside
    document.getElementById("container").scrollTop = 320;
</script>