I am trying to replicate the scrolling behavior like this.
When you scroll the sidebar, it keeps scrolling until it reaches the end. Then any further scrolling on the sidebar is actually scrolled on the main panel. I have the following code:
<div className='wrapper'>
<div className='sidebar'>My sidebar</div>
<div className='main-panel'>
//this is the main panel content on which overflow y scroll is enabled
<div className='row'>
<div className='col-md-8' id='col-1'>
This is the column content I want to scroll when end
of my scroll content of col-2 is reached
</div>
<div className='col-md-4' id='col-2'>
This is the column which when scrolled to the end
will then scroll col-1
</div>
</div>
</div>
</div>
2
Answers
The basic browser behavior is very simple. Scroll the element under the cursor, if it’s at maximum then bubble the event up the DOM.
So the only thing you should do is put the sidebar in the main content. That way both will scroll.
You that W3C example you gave, the sidebar and the document body scroll. Since the sidebar is included in the body, the behavior you want works.
Suggest using fixed sidebar, so when you scroll down your sidebar, the main content will start to scroll (up or down). There you have simple example: