Sticky DIV stays fixed at the bottom during scrolling without covering the footer section

I need help with making one DIV stick to the bottom of the screen while scrolling, without overlapping the footer. I have tried using fixed bottom but it overlaps the footer. I also attempted to set a higher z-index for the footer, but I would prefer the sticky DIV not to go behind the footer. What I want is for the sticky DIV to dock at the top of the footer when the user scrolls down and then follow back up when scrolled up, always staying at the bottom of the screen.

Here is a link to the code snippet

 <!-- 
  Bootstrap docs: https://getbootstrap.com/docs
-->

<div class="container">
  <div class="row">
    <div class="col">
One  
 Lorem ipsum dolor sit amet, consectetur adipiscing elit...[truncated for brevity]
...</div>

  </div>
  <div class="row">
    <div class="col">
This DIV Sticks BECAUSE IMPORTANT INFO GOES HERE    </div>

  </div>  
    <div class="row">
    <div class="col">
Three  
 Lorem ipsum dolor sit amet, consectetur adipiscing elit...[truncated for brevity]...</div>

  </div>  
    <div class="row">
    <div class="col">
Four   
 Lorem ipsum dolor sit amet, consectetur adipiscing elit...[truncated for brevity]...</div>

  </div>  
    <div class="row">
    <div class="col">
Five    </div>

  </div>  

</div>
 <!-- Footer -->
<footer class="page-footer font-small blue pt-4" style="background-color:orange;">

    <!-- Footer Links -->
    <div class="container-fluid text-center text-md-left">
        ...[truncated for brevity]...
      </div>
      <!-- Grid row -->

    </div>
    <!-- Footer Links -->

    <!-- Copyright -->
    <div class="footer-copyright text-center py-3">© 2018 Copyright:
      <a href="https://mdbootstrap.com/bootstrap-tutorial/"> MDBootstrap.com</a>
    </div>
    <!-- Copyright -->

  </footer>
  <!-- Footer -->

Answer №1

To add this feature to your website, you'll have to implement JavaScript. Take a look at the following question for detailed instructions on how to accomplish it:

'Creating fixed div that limits at footer'

Limiting fixed element to stop at footer

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Getting data in a ng-Dialog Modal with AngularJS is a breeze!

Hi there, I'm new to Angular JS and facing an issue with displaying data from my MySQL database in a table as well as in a modal for more detailed information: I've included the HTML file named _detail_modal.html at the bottom of the page. ...

Angular 4 - Issue with Top Navigation Bar not remaining fixed at the top of the page

I'm having trouble finding a solution to keep the top navigation bar fixed at the top of the screen without allowing it to scroll when the page becomes too long. I want to prevent the top nav bar from scrolling and maintain its position at the top of ...

Utilize JavaScript, specifically jQuery, to style the pricing

Currently, I am dealing with a website that is displaying prices in the format KD45.000. My goal is to have the "KD" and the three zeros following the decimal point appear at half the height of the number 45. Appreciate any help or suggestions. Cheers, ...

Using JavaScript, generate table rows and cells

Hey there, I'm struggling with formatting my table correctly within the designated section. Currently, it's printing the rows one below the other instead of creating a 'tr' and multiple 'td' elements for each input field. The ...

Looping through iterations to create circular patterns

How can I fix my code to draw multiple circles in a loop instead of just one? var ss_links_canvas = document.getElementById("ss_links_canvas"); ss_links_canvas.width = images.length * 41; ss_links_canvas.height = 25; var ss_links = ss_links_canvas.getCont ...

"Strategies for selecting the initial child element of the currently active item within a diverse array of car

My carousel slides one item at a time, and I am cloning the items. I am trying to add the "selected" class to the first child of the active class. I originally used https://www.bootply.com/HNtK6pWwFp#, but have since converted it for bootstrap 4. I attem ...

"Enable a smooth transition and switch the visibility of a div element when clicked

How to create a dropdown form with a transition effect that triggers on click of an element? Once triggered, the transition works smoothly but clicking again only hides the div element without triggering the transition. See the demo here: Check out the fu ...

Preventing links from functioning on dynamically generated web pages

I have implemented the following code to deactivate all links on a preview page: var disableLink = function(){ return false;}; $('a').bind('click', disableLink); While this successfully disables all static links, any anchor tags loade ...

I would like to have the div completely fill the page on my website

How can I make a div fill the entire height of my website using Bootstrap? I want to ensure that the div extends all the way down Please provide guidance on how to accomplish this. ...

Excel's VBa cannot locate the table within the innerHTML of IE

My current dilemma involves attempting to extract a table from a webpage. The issue is that copying the entire page is not feasible due to buttons and dynamic elements causing a memory overload when pasted into Excel. To work around this, I am trying to ex ...

What are the steps for transitioning with JavaScript?

My goal is to make both the <hr> elements transition, but I'm struggling with only being able to select the lower <hr> using CSS. html { margin-bottom: 0; height: 100%; min-height: 100%; } body { margin-top: 0; height: 100%; ...

Is there a way to overlay a div on a particular line within a p element?

Within this paragraph lies a collection of text encapsulated by a < p > tag. When this content is displayed on the page, it spans across 5 lines. My objective is to creatively style and position a < div > tag in order to highlight a specific li ...

Insert this HTML table along with radio buttons into an Excel spreadsheet

My HTML table contains rows with a variety of content, including plain text characters and elements like radio buttons and lists. I want users to be able to copy-paste the table into MS Excel as plain text and have the radio button values replaced with "c ...

Setting up the bxslider plugin in HTML

I'm having trouble getting an image slider (bxslider) to work on my website, despite following the setup instructions provided on . Here is the html code I've used: <!doctype html> <html> <head> <!-- jQuery library (se ...

Guide for finding the current font of an HTML element

Imagine having a text element styled as follows: font-family: Arial, Verdana, Sans-serif; Is there a way to determine which specific font (Arial, Verdana, or Sans-serif) the browser utilized to display the text? ...

Troubleshooting a Small Scrollbar Problem: Implementing Borders on Your Scrollbar

I'm having trouble defining a border for my scrollbar using Tiny Scrollbar. Whenever I try to do so, the scroll height value is incorrect. Even when using padding, I encounter the same issue. How can I resolve this issue? .scrollable .track { bac ...

What are the steps to modify my webpage's HTML using 3 separate blocks?

Hey there, I'm looking to customize my HTML layout in the following way: https://i.sstatic.net/mgE1G.png This is what I currently have: <app-list-employees></app-list-employees> <app-book-employee></app-book-employee> <app ...

What is the process for choosing and making changes to a specific portion of a textContent?

<h1 id="block ">This is my header block</h1> To dynamically change the color of the "block" word every 2 seconds using JavaScript: let colors = ["blue", "green", "pink", "purple"]; let curColor = 0; const changeColor = () => { ...

What is the best method for eliminating tags from an HTML tag attribute using PHP?

I have a substantial amount of posts created using an old CMS. The content is in HTML markup, but unfortunately it's quite messy. It includes constructs like: ....<IMG alt="Хит сезона - <b>Лучшие фразы...</b>" src=" ...

Guide to displaying options in the Vue material select box even when the default value is blank

I have implemented the material design framework vuematerial with vue.js. In traditional HTML, a selection box looks like this: <select> <option value="">You should initially see this</option> <option value="1">One</o ...