When a two-column layout with a scrollable column experiences difficulty in scrolling continuously

I set out to create a webpage featuring two fixed columns at the top and a footer at the bottom. The main goal is to have the left column remain static while the right column is scrollable.

This is what I aim to achieve -

  1. When the mouse hovers over the left column on top, the entire webpage should scroll up or down.
  2. When the mouse hovers over the right column on top, initial scrolling should only affect the right side. Once the right column has been fully scrolled, then the entire webpage should begin to scroll.

Below is a simple example illustrating my objective and the issue I am encountering:

.row-height {
  height: 100vh;
}

.mid {
  background-color: green;
  height: 100%;
  overflow-y: scroll;
}

::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

.footer {
  height: 1000px;
  background: blue;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<html>

<body>
  <div class="container-fluid">
    <div class="row row-height">
      <div class="col-sm-6 left">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
        in culpa qui officia deserunt mollit anim id est laborum.
      </div>
      <div class="col-sm-6 mid">
        (Content for right column)
      </div>
    </div>
    <div class='footer'></div>
  </div>
</body>

</html>

The code above mostly functions correctly. However, when you hover over the right column and continuously scroll, it smoothly scrolls at first but once it reaches the bottom, it becomes stuck. You must pause your scrolling momentarily and then resume for the whole webpage to start scrolling.

I require the entire webpage to begin scrolling immediately upon reaching the bottom of the right column.

In my current setup, continuous scrolling causes it to become stuck and only resumes working after a brief pause.

Answer №1

Here is a method to achieve this:

.row-height {
  height: 100vh;
}

.mid {
  background-color: green;
}

.mid::-webkit-scrollbar-track {
  margin-top: -10px;
  margin-bottom: -10px;
}

::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

.left {
  position: sticky!important;
  top: 0!important;
  align-self: flex-start!important;
}

.footer {
  height: 1000px;
  background: blue;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<html>

<body>
  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-6 left">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
        in culpa qui officia deserunt mollit anim id est laborum.
      </div>
      <div class="col-sm-6 mid">
        [Text shortened for brevity]
      </div>
    </div>
    <div class="row">
      <div class="col-sm-12">
        <div class='footer'></div>
      </div>
    </div>
  </div>
</body>

</html>

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

Unlinked from the main content, the Angular2 Material2 sidenav stands on its

I am in the process of implementing the material2 sidenav component. My goal is to have a standalone, full-height sidebar that smoothly slides in and out without any interference with the rest of the app layout caused by the sidenav-layout. The desired ou ...

Adjust the font size and center alignment in the navigation bar using Bootstrap

I'm a beginner when it comes to using bootstrap and I'm having trouble adjusting the font size of my application's title. While I was able to change the color of the text, I can't seem to find where the font-size property is located for ...

Position the input element in the middle of the div

Is it possible to center a form input element within a div element without it changing position when the browser window size is adjusted? I attempted using margin: auto and position: relative, but encountered issues with the element moving. How can this be ...

Exploring ways to enhance the appearance of a Sidebar Widget Navigation using JQuery

When creating navigational items with submenus, such as 'Primary Fees', I added an arrow for visual indication. To enhance user experience, I included an animation that rotates the arrow and highlights the Main Menu item in red upon hovering. Thi ...

Creating dynamic HTML table headers from a multidimensional array

In need of a solution to dynamically generate an HTML table header with multi-dimensional arrays. For example, the array structure could be: $Array = ('Sr.No.'=>'', 'Subject'=>array('Maths','Sci',&ap ...

Is it possible to modify the :hover effects of a material-ui outlined select component?

I am currently developing a react application using Material UI. My goal is to change the color of a selector to white when hovering over it. However, I have encountered difficulties in applying the style as intended. Even when directly adding classes, the ...

Struggling to effectively use XPath to target LI elements that contain specific text

Below is the HTML code for the list item in question: <li class="disabled-result" data-option-array-index="1" style="">4" (0)</li> Here is my attempt at using JavaScript to hide this list item, but it's not working as expected: var xpat ...

When clicking on a different tab, the Bootstrap tab will shift to the left, outlining the new selection

While working with Bootstrap, I created a small footer with a tab. However, whenever I click on the second value, the entire div shifts to the left. How can I keep it in place? Below is my code along with two images depicting how the first tab aligns corr ...

The Splitter remains inactive until a peculiar series of actions is taken

Trying to troubleshoot this issue with a library called Split.js, which can be found here: https://github.com/nathancahill/Split.js I've encountered an interesting problem where I have to disable the height CSS property of my container, move the spli ...

Interactive font-awesome icons within an interactive dropdown menu

I am currently facing an issue with using two Fontawesome icons in a clickable dropdown menu. The dropdown menu does not toggle when I click on the icons directly; however, it works when I click on the padding around them. The example provided by W3schools ...

Is there a way to remove the ring shadow in TailwindCSS?

Here is a visual representation of the issue I'm facing (refer to the image): Check out the Image After inspecting with Chrome, it seems like the problem is connected to --tw-ring-shadow. I attempted to use classes like ring-0 and ring-offset-0 (men ...

Enhance the input field with letter control

Here is a snippet of my HTML code for inputs: <form class="form" id="firstForm" novalidate="novalidate"> <div class="tab-content"> <div class="tab-pane active" id="vtab1"> <div class="form-group" ...

Having difficulty locating the login button on the webpage

I am attempting to log into a banking account using selenuim. After opening the webpage and locating the login element, I initially struggled to access it by its "name" or "id." Fortunately, I was able to successfully access it using driver.find_element_by ...

Weak Password Alert

After spending hours writing code for form validation and password strength checking, I encountered a roadblock. The form validates successfully, but the password strength indicator is not updating as expected. Despite double-checking the logic in my code ...

Scrolling Bootstrap tabs

Here is the code snippet provided below: JavaScript: var hidWidth; var scrollBarWidths = 40; var widthOfList = function(){ var itemsWidth = 0; $('.list li').each(function(){ var itemWidth = $(this).outerWidth(); itemsWi ...

The HTML content I created is too large for the screen and is extending beyond its borders

The navigation bar and footer on my HTML page adjust themselves according to the screen width, but the main content is not adjusting properly. I tried using a media query for mobile resolution (517px), but when I tested it on a PC with a smaller screen wi ...

Twist two images in opposite directions around the avatar picture using CSS

Upon hovering over the central image, I want two circles to animate in opposite directions simultaneously. So far, I have only been able to animate them separately by individually hovering over the objects. This is what I'm aiming for: Check out my ...

Understanding the behavior of CSS float (even after thorough examination of W3C documentation)

I am currently facing an issue related to the float property and have provided a snippet of code below for reference. My goal is to achieve a two-column layout using floats. While I am familiar with other methods to achieve this layout, I am specifically i ...

What is the best way to deactivate an <a> tag in React after it has been clicked?

Is there a way to deactivate the anchor tag below in React once it has been clicked? The onClick function is not functioning on the anchor tag. <td align="left"> <input type="file" accept=".csv,.xlsx,.xls" ...

Is the maxlength attribute malfunctioning in Chrome and Safari for HTML forms?

<input type="number" maxlength="5" class="search-form-input" name="techforge_apartmentbundle_searchformtype[radius]" id="techforge_apartmentbundle_searchformtype_radius"> I found this HTML snippet using the Firebug tool in Chrome. In Chrome and Saf ...