How to make an element fake position:fixed so it acts fixed until a certain scroll height, then attaches?
Date : March 29 2020, 07:55 AM
wish helps you You can set position to absolute and attached scroll event to the page and in that event you change top css value based on position of scrollbar (in jQuery it's scrollTop in pure javascript it should be similar), and then you add condition that top is changed only if scrollTop is less then specific value like offset.top + height of the sidebar.
|
make image element fixed position and doesn't move on scroll
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Have you specified a DOCTYPE decalaration in your markup? This should work: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
|
div having fixed height and fixed position make inner content scroll
Tag : html , By : mtnmuncher
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Try overflow-y:scroll Fiddle. This has a container just to show that the position will be maintained .fixed {
height: 200px;
position: fixed;
top: 50px;
overflow-y:scroll;
}
<div class="fixed">
<div class="content">
<h1>
title1
</h1>
<h1>
title2
</h1>
<h1>
title3
</h1>
<h1>
title4
</h1>
<h1>
title5
</h1>
<h1>
title6
</h1>
<h1>
title7
</h1>
</div>
</div>
|
css make background image position fixed and scroll content up
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , How can we do something similar as done in this example http://theme.nileforest.com/html/mazel-v1.1/home-text-rotator1.html* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.block-parallax-1 {
overflow: hidden;
position: relative;
}
.block-parallax-1 .parallax-bg {
background-attachment: fixed;
background-image: url('http://bygaga.com.ua/uploads/posts/1354003535_podborka_krasivih_moto_759-58.jpg');
background-position: 0px 0px;
background-repeat: repeat;
height: 100%;
position: absolute;
width: 100%;
min-width: 1170px;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.block-parallax-1 .md-box {
padding: 200px 0 200px;
background: rgba(0, 0, 0, 0.75);
position: relative;
height: 100%;
text-align: center;
}
.block-parallax-1 .md-box h1 {
color: #fff;
}
.block-parallax-2 .parallax-bg {
background-image: url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ_z73DvFVC1ek9ZsGdCpvpDW_AwRqOWgG6IP2wOXrVibxz_EDV');
}
h2 {
color: #555;
text-align: center;
padding: 25px 0;
margin: 0;
}
<section class="block-parallax-1">
<div class="parallax-bg"></div>
<div class="md-box">
<h1>background-attachment:fixed</h1>
</div>
</section>
<section style="min-height:400px;">
<h2>background</h2>
<p></p>
</section>
<section class="block-parallax-1 block-parallax-2">
<div class="parallax-bg"></div>
<div class="md-box">
<h1>background-attachment:fixed</h1>
</div>
</section>
|
Image resizes when position is changed to fixed on scroll
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Position fixed means that an element will have relative sizes and positioning in relation to the viewport, not their parent elements. Specifically what is happening here is that your div with ID article1Media is set to have a width of 48%. When it has the CSS property of position: relative then that resolves as 48% of the width of it's containing element (the div with id article1) however when it is position fixed that resolves as 48% of the width of the viewport. Since there is an implicit 8px margin on the element then these are different. body{
margin:0px;
}
.image{
margin:8px;
}
.image{
width:500px;
}
@media(min-width:800px){
width:300px;
}
.media.image-fixed{
position:fixed;
width:calc(48% - 8px);
}
|