OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 | |
Julien - ping for review
2014/01/08 15:31:45
Unneeded space.
ostap
2014/01/09 03:44:14
Done.
| |
3 <html> | |
4 <head> | |
5 <style> | |
6 .group { | |
7 display: inline-block; | |
8 position: relative; | |
9 width: 150px; | |
10 height: 500px; | |
11 } | |
12 | |
13 #overflow { | |
14 width: 600px; | |
15 height: 550px; | |
16 overflow: hidden; /* Still scrollable with JS */ | |
17 border: 1px solid black; | |
18 } | |
19 | |
20 .spacer { | |
21 float: left; | |
22 width: 10px; | |
23 height: 1200px; | |
24 } | |
25 .container { | |
26 width: 100px; | |
27 height: 400px; | |
28 outline: 2px solid black; | |
29 } | |
30 | |
31 .box { | |
32 width: 100px; | |
33 height: 200px; | |
34 } | |
35 | |
36 .sticky { | |
37 position: sticky; | |
38 top: 100px; | |
39 background-color: green; | |
40 } | |
41 | |
42 .indicator { | |
43 position: absolute; | |
44 top: 0; | |
45 left: 0; | |
46 background-color: red; | |
47 } | |
48 </style> | |
49 <script> | |
50 function doTest() | |
51 { | |
52 document.getElementById('overflow').scrollTop = 120; | |
53 } | |
54 window.addEventListener('load', doTest, false); | |
55 </script> | |
56 </head> | |
57 <body> | |
58 This test checks that sticky positioned elements are contained by their enclosin g ancestor with an overflow clip. | |
59 There should be no red. | |
60 <div id="overflow"> | |
61 <div class="spacer"></div> | |
62 <div class="group"> | |
63 <div class="indicator box" style="top: 200px;"></div> | |
64 <div class="container"> | |
65 <div class="sticky box"></div> | |
66 </div> | |
67 </div> | |
68 | |
69 <div class="group" style="top: 100px"> | |
70 <div class="indicator box" style="top: 120px;"></div> | |
71 <div class="container"> | |
72 <div class="sticky box"></div> | |
73 </div> | |
74 </div> | |
75 | |
76 <div class="group" style="top: 240px"> | |
77 <div class="indicator box" style="top: 0;"></div> | |
78 <div class="container"> | |
79 <div class="sticky box"></div> | |
80 </div> | |
81 </div> | |
82 </div> | |
83 </body> | |
84 </html> | |
OLD | NEW |