Display the vertical scroll bar of the page when the mouse hovers over it

Struggling to reveal the main page scrollbar upon hover? While working on my portfolio, I hid the page scrollbar. Trying to display the scrollbar when hovering over the main container.

Below is a link to my portfolio page and corresponding code. Any assistance in pure CSS would be greatly appreciated!

Please note that I prefer a solution in pure CSS, without involving JS or jQuery.

::-webkit-scrollbar
    display: none;
    width: 15px
    background-color: #fff

::-webkit-scrollbar-thumb
    display: none;
    
.main-div:hover ::-webkit-scrollbar
    display: inline;
    
.main-div:hover ::-webkit-scrollbar-thumb
    display: inline;
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>

  <!-- Main Section Starts -->
  <section>
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12 col-lg-4 col-sm-12 col-12">
          <aside>
            <div class="personal-info wow animated fadeInLeft">
            
              [Content of personal info section]
              
            </div>
          </aside>
      </div>
      
      <div class="col-md-12 col-lg-8 col-sm-12 col-12">
        <div class="main-div">
        
          <!-- Slider Content Goes Here -->

        </div>
      </div>
    </div>
  </section>
  
</body>
</html>

Portfolio Link: Visit Portfolio

I received answers related to individual divs or sections, not addressing the entire page structure. View Relevant Discussion

Answer №1

Insert this CSS

.main-div{
  overflow:hidden;
  max-height:100vh;
}
.main-div:hover{
    max-height:auto;
    overflow:auto;
 }

.main-div{
  overflow:hidden;
  max-height:100vh;
}
.main-div:hover{
    max-height:auto;
    overflow:auto;
 }
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</head>
<body>
<!DOCTYPE html>
...
...
...
</section>
...
...
...
</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

Trigger a click event on the <select> element, excluding the <option> element

When my select element is clicked, it updates its options using the onclick() listener. However, I am facing an issue where the listener fires when an option is clicked as well, preventing the user from selecting anything in the updated list. groupSelect ...

Is it possible to extract HTML from an ASP.NET 4.0 web form without actually running the page?

When utilizing a pdf component to convert an html page to pdf, there seems to be an issue with authorization when accessing the page via URL. In MVC, I am able to strip the html from the view without having to access it by URL. Is there something similar ...

Exploring Font Choices: Customizing Your Text Style

I've been attempting to incorporate my own font into my website, but despite researching several Stack Overflow articles, I'm facing various browser-specific and path-related issues. Sadly, I haven't been able to successfully display my font ...

Using AngularJS to retrieve DOM elements within a directive's controller

Currently, I am in the process of creating a custom image carousel directive using only AngularJS and no additional libraries. simpleCarousel.$inject = []; function simpleCarousel() { var directive = { restrict: 'E', templat ...

Issues with JQuery draggable functionality not functioning as expected

Is there a way to drag bookmarks on a line and have the text above them change to show the percentage from the right edge? Here is a quick snippet that achieves this, along with a demonstration in this fiddle. Check out the code below: HTML <div id=& ...

Unique content on a web page when it is loaded with HTML

Is there a way to dynamically load various content (such as <img> and <a>) into divs every time a page is loaded? I've seen websites with dynamic or rotating banners that display different content either at set intervals or when the page ...

Exploring the World Wide Web with BeautifulSoup4

I am trying to extract all the times from a webpage and store them in a list variable. How can I achieve this? Any help is appreciated. <div class=panchang-box-secondary-header> <div class="list-wrapper pl-2"> <div class="li ...

Selectors within 'not' in document.querySelectorAll are failing to function as expected

I've been attempting to find a way to replace the jQuery .not() function with native JavaScript, but so far my attempts using document.querySelectorAll have not been successful. Here is what I am trying to achieve - converting this jQuery selector in ...

Issues arise when attempting to use Stylus in conjunction with React

I am currently working on developing a web application that utilizes Stylus and React. I have successfully rewritten all the Stylus language files, but I am encountering an issue where the React components are not being styled as expected. Below is one of ...

The leaking of angular-material CSS onto other divs is causing unexpected styling

I am having trouble incorporating Angular Material's md-autocomplete into my angular application. I have already customized the CSS being used in my application, but when I add the Angular Material CSS, it messes up the entire page. Even when I tried ...

Data input via $_POST method during the submission of a web application is failing to

Having trouble with the login functionality in an EllisLab application framework. The data from the $_POST method is not being stored upon form submission, resulting in an error message. When using var_dump($POST), it shows array(0){}. View Error Screensh ...

Issue encountering with flex-wrap to shift to the next row once reaching the 5th element

Recently, I've been experimenting with creating an image gallery using flexbox and incorporating a flex-basis transition to control the growth and shrinkage of elements upon hover. However, I'm encountering difficulties in adjusting the gallery t ...

Steps for embedding a dynamic 3D model onto a website with THREE.js

Seeking guidance on integrating animated 3D models onto a webpage using THREE.js. Currently, I have successfully loaded a static 3D model named 'aaa.gltf' with auto rotation and orbit control functionality. However, when trying to load another an ...

Exploring the integration of angular with html5 history.pushstate for navigation

Currently, I am enhancing my web application by implementing a new feature. This feature involves writing a script and loading it via a tag manager. The purpose of this script is to target specific UI components, remove them from the DOM, and inject new DO ...

Issue with Bootstrap z-index preventing element from being clickable. In search of a solution to properly layer elements behind one another

Encountering an issue with the accordion on my website - only the first item opens. The culprit is not the data-target. If I disable CSS in my code, everything works fine... Upon further investigation, I discovered that the problem lies with the Z-INDEX p ...

There seems to be an issue with the functionality of Js .classList.add()

Currently, I am in the process of creating a simple movie site and am working on the home page. On the home page, there is a carousel. In CSS, I have hidden the visibility of all slides, and my plan is to create an array for all the slides in JavaScript an ...

Challenges with Implementing Background Images on my Website with HTML and CSS

Being new to the world of coding, I recently created a website for a college presentation. However, after uploading the website onto the internet, I noticed that the background images from my files are not displaying on the website. It's likely that I ...

The xpath selector in Python/Selenium has unexpectedly ceased to function

Currently, I have a script designed to extract names from a crypto list on coinmarketcap. The function I utilize to obtain these names is as follows: num = 0 def print_name(): global num num = num + 1 if num == 100: exit() sleep(0. ...

Tips for utilizing the pixel-based margin and padding properties in Bootstrap 4

Can Bootstrap's margin and padding properties be used with pixel values instead of rems in Bootstrap 4? For instance, if I want a div to have a margin-left of 20 pixels, can I do the following: <div class="container ml-20">Hi</div&g ...

Tips for preventing conflicts between JQuery libraries

Need help resolving conflicts between jQuery libraries in a multiple step form with a date and time picker dropdown menu. The form works when one library is disabled, but not both. Tried online solutions with no success. <!DOCTYPE html> <html l ...