fix: overflow on 320px screens

This commit is contained in:
atomiks
2018-03-03 19:03:38 +10:00
parent 7250a9adfa
commit 7f2638cd38
4 changed files with 34 additions and 34 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1025,7 +1025,7 @@ var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop
content: ''; content: '';
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 300px; width: 240px;
height: 25px; height: 25px;
background: linear-gradient( background: linear-gradient(
rgba(255, 255, 255, 0.001), rgba(255, 255, 255, 0.001),
@ -1036,8 +1036,8 @@ var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop
.overflow-scroll-gradient__scroller { .overflow-scroll-gradient__scroller {
overflow-y: scroll; overflow-y: scroll;
background: white; background: white;
width: 300px; width: 240px;
height: 250px; height: 200px;
padding: 15px 0; padding: 15px 0;
line-height: 1.2; line-height: 1.2;
text-align: center; text-align: center;
@ -1059,7 +1059,7 @@ var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop
content: ''; content: '';
background: linear-gradient(rgba(255, 255, 255, 0.001), white); background: linear-gradient(rgba(255, 255, 255, 0.001), white);
position: absolute; position: absolute;
width: 300px; width: 240px;
height: 25px; height: 25px;
bottom: 0; bottom: 0;
pointer-events: none; pointer-events: none;
@ -1067,15 +1067,15 @@ var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop
.snippet-demo__overflow-scroll-gradient__scroller { .snippet-demo__overflow-scroll-gradient__scroller {
overflow-y: scroll; overflow-y: scroll;
background: white; background: white;
width: 300px; width: 240px;
height: 250px; height: 200px;
padding: 15px 0; padding: 15px 0;
line-height: 1.2; line-height: 1.2;
text-align: center; text-align: center;
} }
</style> </style>
<script> <script>
document.querySelector('.snippet-demo__overflow-scroll-gradient__scroller').innerHTML = 'content '.repeat(200) document.querySelector('.snippet-demo__overflow-scroll-gradient__scroller').innerHTML = 'content '.repeat(100)
</script> </script>
<h4>Explanation</h4> <h4>Explanation</h4>
<ol> <ol>
@ -1083,7 +1083,7 @@ var y = e.pageY - btn.offsetTop - btn.offsetParent.offsetTop
<li><code>::after</code> defines a pseudo element.</li> <li><code>::after</code> defines a pseudo element.</li>
<li><code>background-image: linear-gradient(...)</code> adds a linear gradient that fades from transparent to white (top to bottom).</li> <li><code>background-image: linear-gradient(...)</code> adds a linear gradient that fades from transparent to white (top to bottom).</li>
<li><code>position: absolute</code> takes the pseudo element out of the flow of the document and positions it in relation to the parent.</li> <li><code>position: absolute</code> takes the pseudo element out of the flow of the document and positions it in relation to the parent.</li>
<li><code>width: 300px</code> matches the size of the scrolling element (which is a child of the parent that has the pseudo element).</li> <li><code>width: 240px</code> matches the size of the scrolling element (which is a child of the parent that has the pseudo element).</li>
<li><code>height: 25px</code> is the height of the fading gradient pseudo-element, which should be kept relatively small.</li> <li><code>height: 25px</code> is the height of the fading gradient pseudo-element, which should be kept relatively small.</li>
<li><code>bottom: 0</code> positions the pseudo-element at the bottom of the parent.</li> <li><code>bottom: 0</code> positions the pseudo-element at the bottom of the parent.</li>
<li><code>pointer-events: none</code> specifies that the pseudo-element cannot be a target of mouse events, allowing text behind it to still be selectable/interactive.</li> <li><code>pointer-events: none</code> specifies that the pseudo-element cannot be a target of mouse events, allowing text behind it to still be selectable/interactive.</li>

View File

@ -22,7 +22,7 @@ Adds a fading gradient to an overflowing element to better indicate there is mor
content: ''; content: '';
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 300px; width: 240px;
height: 25px; height: 25px;
background: linear-gradient( background: linear-gradient(
rgba(255, 255, 255, 0.001), rgba(255, 255, 255, 0.001),
@ -33,8 +33,8 @@ Adds a fading gradient to an overflowing element to better indicate there is mor
.overflow-scroll-gradient__scroller { .overflow-scroll-gradient__scroller {
overflow-y: scroll; overflow-y: scroll;
background: white; background: white;
width: 300px; width: 240px;
height: 250px; height: 200px;
padding: 15px 0; padding: 15px 0;
line-height: 1.2; line-height: 1.2;
text-align: center; text-align: center;
@ -59,7 +59,7 @@ Adds a fading gradient to an overflowing element to better indicate there is mor
content: ''; content: '';
background: linear-gradient(rgba(255, 255, 255, 0.001), white); background: linear-gradient(rgba(255, 255, 255, 0.001), white);
position: absolute; position: absolute;
width: 300px; width: 240px;
height: 25px; height: 25px;
bottom: 0; bottom: 0;
pointer-events: none; pointer-events: none;
@ -67,8 +67,8 @@ Adds a fading gradient to an overflowing element to better indicate there is mor
.snippet-demo__overflow-scroll-gradient__scroller { .snippet-demo__overflow-scroll-gradient__scroller {
overflow-y: scroll; overflow-y: scroll;
background: white; background: white;
width: 300px; width: 240px;
height: 250px; height: 200px;
padding: 15px 0; padding: 15px 0;
line-height: 1.2; line-height: 1.2;
text-align: center; text-align: center;
@ -76,7 +76,7 @@ Adds a fading gradient to an overflowing element to better indicate there is mor
</style> </style>
<script> <script>
document.querySelector('.snippet-demo__overflow-scroll-gradient__scroller').innerHTML = 'content '.repeat(200) document.querySelector('.snippet-demo__overflow-scroll-gradient__scroller').innerHTML = 'content '.repeat(100)
</script> </script>
#### Explanation #### Explanation
@ -86,7 +86,7 @@ document.querySelector('.snippet-demo__overflow-scroll-gradient__scroller').inne
3. `background-image: linear-gradient(...)` adds a linear gradient that fades from transparent to white 3. `background-image: linear-gradient(...)` adds a linear gradient that fades from transparent to white
(top to bottom). (top to bottom).
4. `position: absolute` takes the pseudo element out of the flow of the document and positions it in relation to the parent. 4. `position: absolute` takes the pseudo element out of the flow of the document and positions it in relation to the parent.
5. `width: 300px` matches the size of the scrolling element (which is a child of the parent that has 5. `width: 240px` matches the size of the scrolling element (which is a child of the parent that has
the pseudo element). the pseudo element).
6. `height: 25px` is the height of the fading gradient pseudo-element, which should be kept relatively small. 6. `height: 25px` is the height of the fading gradient pseudo-element, which should be kept relatively small.
7. `bottom: 0` positions the pseudo-element at the bottom of the parent. 7. `bottom: 0` positions the pseudo-element at the bottom of the parent.