0

enter image description here

Consider that my mouse positioned on Sidebar and I use the mouse wheel to scroll to the bottom or top of Sidebar. When I reach the bottom of Sidebar and keep scrolling with the wheel, it will begin to scroll Main Content. I would like the mouse wheel to only scroll the current div that the cursor is sitting on.

Is this possible with CSS? Or do I need to wire up JS/jQuery events to detect the div I am currently on and stop the scroll event? I am hoping there is a CSS solution to this.

Thanks In Advance

2

1 Answer 1

1

It should just work with regular CSS. Try handling both sections as separat containers. Here is a simplified example i built based on your illustration:

.sidebar {
  height: 100vh;
  width: 30%;
  float: left;
  overflow-y: scroll;
  background-color: rgb(83, 83, 83);
}

.main-content {
  height: 100vh;
  width: 70%;
  float: left;
  overflow-y: scroll;
  background-color: rgb(139, 139, 139);
}

.content {
  height: 500vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3em;
}
 <div class="sidebar">
  <div class="content">Sidebar</div>
</div>
<div class="main-content">
  <div class="content">Main Content</div>
</div>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.