Scrolling the inner div with the main scrollbar before navigating through the rest of the page

In my hero div, I have a container div called right-col that contains two inner divs. These inner divs are sticky, creating the effect of cards sliding up when the container div is scrolled.

This is the HTML structure:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div class="hero">
        <div class="left-col">h</div>
        <div class="right-col">
            <div class="top">1st card</div>
            <div class="bottom">2nd Card</div>
        </div>
    </div>
    <div class="projects">a</div>
    <div class="contact-footer"></div>
    <div></div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">

</script>
</html>

And this is the CSS styling:

body{
    overflow: auto;
    background-color: black;
}
.hero {
    display: flex;
    flex-direction: row;
}

.left-col{
    width: 40vw;
    background-color: black;
    height: 100vh;
}
.right-col{
    min-width: 60vw;
    background-color: blue;
    overflow: auto;
    height: 100vh;
}
.top{
    height: 100vh;
    background-color: chartreuse;
    position: sticky;
    top: 0;
}
.bottom{
    height: 100vh;
    background-color: orange;
    position: sticky;
    top: 10%;
}

.projects{
    height: 100vh;
    background-color: crimson;
    position: sticky;
    top: 0;
}

Currently, the scrollbar is contained within the right-col div and does not link with the main scrollbar. Is there a way to synchronize the main scrollbar to scroll through the container div until it reaches the bottom, and then continue scrolling through the rest of the page? Possibly utilizing JavaScript or jQuery?

Answer №1

To achieve the desired effect of hiding the inner scroll bar while still maintaining functionality, consider implementing the following CSS code. This code sets the width of the inner scroll bar to 0 pixels, effectively rendering it invisible but operational.

.main-content ::-webkit-scrollbar {
  width: 0px;
}

For a more tailored solution, you may explore utilizing the scroll event to potentially synchronize both scroll bars or implement a different approach.

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

The method .depth() does not exist within this context

When I attempted to execute this code using npm start in the terminal //index.js const api = require('./api'); console.log('Starting monitoring!'); setInterval(async () => { //console.log(await api.time()); console.log(await ...

Prevent a div from scrolling once it reaches the end of its content, while allowing the other div to continue

I am trying to make the col-md-4 column stop scrolling once it reaches the end of the content, similar to the right sidebar on Facebook. I have attempted using jQuery to add a fixed position when it reaches the bottom, but it is not working as expected. Th ...

Achieving bottom alignment for a button in Bootstrap 4

<div class="row"> <div class="col-lg-3 col-md-6 col-11 d-flex flex-column text-center ng-star-inserted"> <div class="card prcard"> <img height="200px" alt="Card image cap" class="card-img-top mx-auto d-block" ...

Fulfill a promise based on a particular event in Puppeteer

I am looking for a way to seamlessly continue my puppeteer code after a particular event occurs. Specifically, I need guidance on how to handle the 'request' event in a synchronous manner. Here is an example of the event code: await page.on(&apo ...

Transition not influencing the scale property when activating a class

My modal is not scaling in and out properly when I toggle the 'active' class. It either fully scales out or scales in without any transition. Example: const openPopupButtons = document.querySelectorAll('[data-popup-target]'); const ...

Exploring the depths of Nesting in Next.js Links

After trying to nest the Badge inside the Link element and wrapping it in an <a> tag, I managed to resolve some errors but one persists: https://i.sstatic.net/o1WfA.png import { useState } from 'react'; import Link from 'next/link&apo ...

Experiencing difficulties accessing Facebook using ngFacebook on angularjs application

I've been working on implementing ngFacebook login into my Angular app, but I'm facing an issue with logging in to Facebook. Even after calling '$facebook.log()', nothing is being displayed in the console. This is a snippet of my Angul ...

Is it possible for style sheets to malfunction due to the presence of the TITLE attribute on <link> tags?

We are currently involved in the process of upgrading an outdated corporate intranet. The challenge is that our users primarily rely on IE8 and IE9, while most of our sites were designed to function with compatibility for browsers between IE5 - IE9. While ...

What is the proper method for appending a string to the id of a React JSX div element?

Is it possible to dynamically change the id of a div in JSX using the following code snippet? { ['A','B','C','D'].map((element, cell) => ( <div id="alphabet_{element}"> Some </div> )) ...

Is it possible to incorporate multiple searchBoxes on my website using the Google Maps API?

I am currently working on creating an origin and destination menu for users to select locations in each input. The goal is to add a marker to the map for each input and then calculate the distance between them. So far, I have successfully added a map with ...

What could be the issue with this particular Ajax script?

I am facing an issue with this JavaScript code - it runs smoothly in Chrome and IE, but encounters a problem in Firefox. I need assistance in identifying the issue. Can anyone help? <script> function checkGurantee() { var gurantee = document.get ...

Converting a jQuery.ajax POST request to a GET method

Here is the jQuery code I am currently using: $.ajax({ url: Url, dataType: 'JSONP', type: 'POST', success: function (data, textStatus, jqXHR) { //callback function here }, ...

Error encountered: Unexpected syntax error found in jQuery ajax call

I am attempting to send a simple request to Instagram using the code snippet below: $.getJSON("https://www.instagram.com/kidsfromthe90sband/media/?callback=?", function(data) { alert(JSON.stringify(data)); }); http://jsfiddle.net/FPhcr/731/ ...

Solution for Organizing Tables

I've sourced data from various JSON API links and displayed it in a table. Currently, my code looks like this: <script src="js/1.js"></script> <script src="js/2.js"></script> Above this code is the table structure with <t ...

What is the reason for JavaScript documentation using a nested array to define a function's parameters in its syntax?

I'm struggling to articulate my question, but as I delve into the documentation for JavaScript and Node.js, I notice they define syntax in a way such as this. var new_array = old_array.concat(value1[, value2[, ...[, valueN]]]) It seems like all th ...

What methods are most effective for designing a static side panel featuring a personalized tree-style list?

I am currently working on a sidebar design which is not rendering correctly, displaying a lot of flicker when expanded. I opted for b-nav instead of a traditional sidebar due to the interference it caused with my horizontal navigation bar. Here are my code ...

Is it still beneficial to incorporate image sprites in the design of a mobile web app?

As I work on developing a mobile web app, I find myself debating whether to use individual images or stick with image sprites similar to what I do for my desktop site. My main concern is the potential increase in file size from consolidating all the images ...

Creating a JavaScript alert in Selenium Java WebDriver with a concise message

While running a Selenium Java program, I am attempting to create a JavaScript alert window with a specific string message. I came across a method that involves executing JavaScript within Selenium by interacting with hidden elements: WebDriver driver; Java ...

The javascript file is unable to detect the presence of the other file

I am facing an issue with two JavaScript files I have. The first one contains Vue code, while the other one includes a data array where I created the 'Feed' array. However, when trying to output a simple string from that array, the console throws ...

Transmit console log data to a PHP webpage

Is there a way to pass the values collected from a Bootstrap table using console.log to a URL via POST method upon button click? var $table = $('#table'); var $button = $('#button'); function getRowSelections() { re ...