1
I have a div
of id = 'retangulo'
with position:absolute;
. When the page loads, this vertical rectangle only appears in half. I want when the person rolls the site at a time when the whole rectangle appears, he gets the position:fixed;
always following the movement of the screen.
header{
width:100%;
height:150px;
background-color:#423142;
}
div#retangulo{
width:50px;
height:400px;
background-color: green;
position:absolute;
top:220px;
left:100px;
}
footer{
height:200px;
width:100%;
background-color:red;
position:absolute;
top: 1500px;
}
<header></header>
<div id="retangulo">
{texto exemplo....}
</div>
<footer></footer>
Exemplifying with the fiddle: https://jsfiddle.net/pjegfkrz/
Following the example: As you can notice, when opening the example, we see that we are not seeing completely the div of the rectangle, but there is a moment when rolling down you can see the whole rectangle. At that point, I’d like the rectangle to have the position:fixed;
accompanying the screen.
Could share your code or provide a Fiddle?
– BrTkCa
You want when the user decreases the screen to change to
position:fixed;
?– Taisbevalle
This, when the user scrolls down to a certain height, the
position
stayabsolute
, but when it comes to that, switch toposition:fixed;
– Nicolas S.
I still don’t understand what you want. I could explain a little more?
– Randrade