Created
June 6, 2017 04:58
-
-
Save JawsomeJason/238e20d495acb0204a6fd07bcabdd6a7 to your computer and use it in GitHub Desktop.
create scrollable content with sticky gradient overlay on top and bottom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gradient-overflow(@size: 24px, @color: white) { | |
// content will scroll if not enough space | |
overflow-y: auto; | |
// add a sticky gradient to the top and bottom of content | |
// it'll overlay over content if needed | |
&:before, | |
&:after { | |
content: ''; | |
display: block; | |
position: sticky; | |
z-index: 1; | |
left: 0; | |
height: @size; | |
// clicks/touches will go through them | |
pointer-events: none; | |
} | |
&:before { | |
top: 0; | |
background: linear-gradient(to bottom, @color, transparent); | |
} | |
&:after { | |
bottom: 0; | |
background: linear-gradient(to top, @color, transparent); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment