OLD | NEW |
1 <html> | 1 <html> |
2 | 2 |
3 <body style="height: 10000px"> | 3 <body style="height: 10000px"> |
4 | 4 |
5 <button id="toggle">Toggle</button> | 5 <button id="toggle">Toggle</button> |
6 | 6 |
7 <p> | 7 <p> |
8 The black rectangle starts fixed, and due to a -webkit-transform will be compo
sited. Toggle to unfix it and scroll: the black rectangle should scroll with the
page and not overlap the numbers. | 8 The black rectangle starts fixed, and due to a transform will be composited. T
oggle to unfix it and scroll: the black rectangle should scroll with the page an
d not overlap the numbers. |
9 </p> | 9 </p> |
10 | 10 |
11 <div id="rect" style="background-color: black; width: 200px; height: 200px; po
sition: fixed; -webkit-transform: translate3d(0,0,0)"> | 11 <div id="rect" style="background-color: black; width: 200px; height: 200px; po
sition: fixed; transform: translate3d(0,0,0)"> |
12 </div> | 12 </div> |
13 | 13 |
14 1<br> | 14 1<br> |
15 2<br> | 15 2<br> |
16 3<br> | 16 3<br> |
17 4<br> | 17 4<br> |
18 5<br> | 18 5<br> |
19 6<br> | 19 6<br> |
20 7<br> | 20 7<br> |
21 8<br> | 21 8<br> |
(...skipping 15 matching lines...) Expand all Loading... |
37 var toggle = document.getElementById("toggle"); | 37 var toggle = document.getElementById("toggle"); |
38 | 38 |
39 toggle.addEventListener("click", function (ev) { | 39 toggle.addEventListener("click", function (ev) { |
40 if (rect.style.position === "fixed") { | 40 if (rect.style.position === "fixed") { |
41 rect.style.position = ""; | 41 rect.style.position = ""; |
42 } else { | 42 } else { |
43 rect.style.position = "fixed"; | 43 rect.style.position = "fixed"; |
44 } | 44 } |
45 }); | 45 }); |
46 </script> | 46 </script> |
OLD | NEW |