position fixed element is overlapping into footer

awebdev

enter image description here

<header class="entry-header">

		<div class="right-side">
      
      <h1 class="entry-title">Desk</h1><p>$99</p><p>500x200x600</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent molestie velit erat, nec porta diam fringilla vel. Nunc id euismod purus. Sed enim tellus, auctor a tempor eget, mattis sit amet massa. Etiam imperdiet elit eu faucibus vestibulum. Fusce ultrices ex quis turpis vulputate vehicula. Nulla laoreet vulputate nunc ac pretium. Pellentesque ac velit nec quam rhoncus sagittis eget porttitor lectus. Curabitur egestas vehicula lacinia. Proin ullamcorper, orci id dapibus viverra, libero ex imperdiet ex, quis lacinia dui dui vel est. Quisque condimentum nulla non elit rutrum, non mollis enim volutpat. Vestibulum mattis at magna sed porta. Cras venenatis ex dignissim nisl facilisis maximus. Integer efficitur vel augue vitae consequat. Sed ac fermentum lacus. Nulla facilisi.</p>
  
		
			<div class="before">

        <p>Before:</p>

        <img class="beforeimage" src="img.jpg" alt="" />

			</div><!-- end before -->

		</div><!--end right-side-->
		
		<!--repeater field-->
		<div class="left-side">
		
			<ul class="slides">

			
				<li class="slide">

						<img src="img1.jpg" alt="Featured Desk">

				</li>

			
				<li class="slide">

						<img src="img2.jpg" alt="Featured Desk">

				</li>

			
				<li class="slide">

						<img src="img3.jpg" alt="">

				</li>

			
				<li class="slide">

						<img src="img4.jpg" alt="">

				</li>

			
				<li class="slide">

						<img src="img5" alt="">

				</li>

			
			</ul>

		</div><!-- end left-side -->

		<!--end single furniture repeater-->

			
</header><!-- .entry-header -->

My page is split in half. The div encompassing the left side is position static. The div encompassing right side content is position fixed. The problem I am having is, when I reduce the screen width, the fixed position right side overlaps into the footer. There is also a div surround both left and right side. I appreciate any answer/suggestions! Let me know if more context is needed.

.left-side {
	display: flex;
	flex-direction: column;
	width: 50%;
}

.right-side {
	display: flex;
	flex-direction: column;
	margin-left: 50%;
	position: fixed;
	margin-right: $main-side-margins;
}

awebdev

I added some JavaScript to solve my problem. I also had to use jQuery Waypoint. What the JavaScript code does, is triggers a new class that makes the right-side div "position: static" once the bottom of the left-side div comes into the window view. This prevents the right side from ever going lower than the left side, thus, preventing overlap into the footer. I've attached the JS code and some new CSS.

.right-side-to-static {
	position: static !important;
	margin-top: 115%;

	@media only screen and (max-width: 1370px) {
   		margin-top: 100%;
	}
	
	@media only screen and (max-width: 1140px) {
   		margin-top: 75%;
	}

	@media only screen and (max-width: 890px) {
   		margin-top: 50%;
	}

	@media only screen and (max-width: 820px) {
   		margin-top: 40%;
	}

	@media only screen and (max-width: 730px) {
   		display: none;
	}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

const $rs = $('.right-side');
const $ls = $('.left-side');

let rsHeight = $('.right-side').height();
let lsHeight = $('.left-side').height();

let counter = 0;

console.log(rsHeight);

$ls.waypoint(function(direction){

    counter++

    if(counter > 2){
      console.log('bottom in view...');
      $rs.toggleClass('right-side-to-static'); 
    }


    
},{
 //bottom-in-view will ensure event is thrown when the element's bottom crosses
 //bottom of viewport.
 offset: 'bottom-in-view'
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

position: fixed overlapping page

From Dev

fixed position header overlapping

From Dev

Position fixed overlapping issue?

From Dev

position relative overlapping position fixed

From Dev

Avoiding overlapping with fixed element

From Dev

section position: fixed overlaps footer

From Dev

Position of footer can't fixed

From Dev

Position fixed till before footer

From Dev

Position of footer can't fixed

From Dev

position:fixed footer in iPhone iOS

From Dev

Keeping fixed footer and header from overlapping

From Dev

Position a p element in footer

From Dev

CSS position:fixed is working for the header but not for the footer

From Dev

Aside navigation height to footer, not in fixed position

From Dev

Aside navigation height to footer, not in fixed position

From Dev

Position: Fixed - pushing my footer over header

From Dev

DIV Position Fixed, inner content overlapping

From Dev

Position a fixed element below another fixed element

From Dev

Fixed position element inside absolute position element

From Dev

Fixed position element inside absolute position element

From Dev

Firefox position fixed element flash

From Dev

How to prevent fixed button from overlapping footer area and stop the button on top of where the footer is located

From Dev

itext pdf : how to position element above footer

From Dev

fixed position of an element inside a container element

From Dev

How to position a relative element after a fixed element

From Dev

Footer is Overlapping an element, Quick Solution to auto push it down?

From Dev

Stop header footer from loosing position:fixed with click - Jquery Mobile

From Dev

Sticky footer on fixed position sidebar, want css solution

From Dev

Header in fixed position is overlapping with container div when the window is reduced in width

Related Related

  1. 1

    position: fixed overlapping page

  2. 2

    fixed position header overlapping

  3. 3

    Position fixed overlapping issue?

  4. 4

    position relative overlapping position fixed

  5. 5

    Avoiding overlapping with fixed element

  6. 6

    section position: fixed overlaps footer

  7. 7

    Position of footer can't fixed

  8. 8

    Position fixed till before footer

  9. 9

    Position of footer can't fixed

  10. 10

    position:fixed footer in iPhone iOS

  11. 11

    Keeping fixed footer and header from overlapping

  12. 12

    Position a p element in footer

  13. 13

    CSS position:fixed is working for the header but not for the footer

  14. 14

    Aside navigation height to footer, not in fixed position

  15. 15

    Aside navigation height to footer, not in fixed position

  16. 16

    Position: Fixed - pushing my footer over header

  17. 17

    DIV Position Fixed, inner content overlapping

  18. 18

    Position a fixed element below another fixed element

  19. 19

    Fixed position element inside absolute position element

  20. 20

    Fixed position element inside absolute position element

  21. 21

    Firefox position fixed element flash

  22. 22

    How to prevent fixed button from overlapping footer area and stop the button on top of where the footer is located

  23. 23

    itext pdf : how to position element above footer

  24. 24

    fixed position of an element inside a container element

  25. 25

    How to position a relative element after a fixed element

  26. 26

    Footer is Overlapping an element, Quick Solution to auto push it down?

  27. 27

    Stop header footer from loosing position:fixed with click - Jquery Mobile

  28. 28

    Sticky footer on fixed position sidebar, want css solution

  29. 29

    Header in fixed position is overlapping with container div when the window is reduced in width

HotTag

Archive