I'm creating a horizontally scrolling div of music albums and want to have a fade on the right hand side of the div to help convey that the list scrolls horizontally.
I've almost cracked it, but can't quite understand why I can't get it exactly the way I want.
Here is a codepen of what I have so far... The fade (red for the sake of the example) works perfectly if the position is set to absolute
but fails when set to fixed
- which is what I need.
CodePen link
For a linear fade, drag perfectly horizontally. For a logarithmic fade, drag up or down. For a cosine (S-curve) fade, hold down Ctrl (Windows) or Command (Mac OS).
Horizontal scrolling is a one-page navigation method designers can use. In this method, users can use different functionalities on a page to scroll right or left, to see more information within the container or window. Users scroll horizontally by clicking on a scroll bar and dragging it with their mouse or finger.
Attach the fade to the .artist__media
not to .content
.
Like this:
.artist__media {
margin-top: 50px;
position: relative;
&:after {
content: "";
position: absolute;
z-index: 1;
top: 0;
right: 0;
bottom: 15px;
pointer-events: none;
background-image: linear-gradient(to right, rgba(255,255,255,0), red 85%);
width: 15%;
}
.content {
white-space: nowrap;
overflow-x: scroll;
overflow-y: hidden;
position: relative;
}
}
See the fiddle. Is that what you wanted?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With