Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Last active March 28, 2018 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolanlawson/ef8106169c85d6acc3be8a1213d14342 to your computer and use it in GitHub Desktop.
Save nolanlawson/ef8106169c85d6acc3be8a1213d14342 to your computer and use it in GitHub Desktop.
Firefox position:sticky jank repro
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
font-size: 14px;
line-height: 1.4;
color: black;
background: lightblue;
position: fixed;
left: 0;
right: 0;
bottom: 0;
top: 0;
}
.container {
overflow-y: auto;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
position: absolute;
top: 42px;
left: 0;
right: 0;
bottom: 0
}
main {
position: relative;
width: 602px;
max-width: 100vw;
padding: 0;
box-sizing: border-box;
margin: 30px auto 15px;
background: white;
border: 1px solid black;
border-radius: 1px;
min-height: 70vh
}
button {
font-size: 1.2em;
background: royalblue;
border-radius: 2px;
padding: 10px 15px;
border: 1px solid gray;
color: white
}
.sticky-wrapper {
width: 100%;
display: flex;
justify-content: flex-end;
position: -webkit-sticky;
position: sticky;
top: 10px;
z-index: 1000;
pointer-events: none
}
.big-list {
height: 6000px;
}
</style>
</head>
<body>
<div class="container">
<main>
<div class="the-box ">
<h1>Scroll down</h1>
<div class="sticky-wrapper">
<button>I AM STICKY</button>
</div>
<div class="big-list"></div>
</div>
</main>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment