there is a page that contains information about the author. I’m trying to achieve the following result when scrolling the text: https://streamable.com/4cvcgq (This is a version of the application for iOS (made on Swift), I am making a web analogue).
Here is my HTML:
<div class="curator__info">
<div class="curator__details">
<h1 class="curator__name" v-text="curator.name" />
<p class="curator__about" v-text="curator.about" />
</div>
</div>
Here is my CSS:
.curator__info {
position: absolute;
height: 100%;
bottom: 0;
z-index: 2;
padding: 2rem;
flex-direction: column;
justify-content: flex-end;
overflow: hidden;
}
.curator__details {
flex: auto;
position: relative;
flex: 0 1 80%;
bottom: 50px;
overflow-y: auto;
padding-top: 55%;
}
.curator__name {
margin-bottom: 1.5rem;
position: sticky;
top: -86%;
}
It seems ready, and it can be done without JS, but there is one single problem that I cannot solve, the text curator__about (description) fits under curator__name (curator’s name), here is the video:
https://streamable.com/ov2n2b
It is necessary to somehow prevent the texts from overlapping each other, a simple solution would be to give a background-color to the curator__name element, and then this overlapping text will not be visible, but this is not what we need. I will be glad if you can help)
Here is a link to the site, you can look by clicking on the photo or name:
Tutorial:
2
Answers
We need to tweak around with the
height
of the.curator__about
, and then add aoverflow-y: scroll;
to it, to make it scrollable, like so:and then tweak around with the
top
, or completely remove thetop: -86%;
from the.curator__name
, and it will look and behave properly.For now* I think the way to solve this is to use a faux-crop to avoid breaking page scroll (causes more problems than it solves – e.g. minimal-ui on iOS)
The basic idea is to have a cropped copy of the main image inside the info block and place the about text behind it
*You might be able to solve it using animation-timeline – but browser support is not great at the moment