I'm using drupal and I cannot change the html. The problem is that all the other articles said to include a container, and I cannot do that. How do I vertical scroll with mouse movement? Example: https://test-ca3969.webflow.io/ (see the OUR LOCATIONS section).
HTML:
<div class="view-content"<div class="topic"></div>
<div class="topic"></div>
<div class="topic"></div>
...
<div/>
CSS:
.view-content{
overflow-y: scroll;
overflow-x: hidden;
height: 500px;
}
Is there a way to do something like the following code, but replace "window" with something like "$('.view-content')"?
JS:
// Variables for current position
var y;
function handleMouse(e) {
// Verify that x and y already have some value
if (y) {
// Scroll window by difference between current and previous positions
window.scrollBy(0, e.clientY - y);
}
// Store current position
y = e.clientY;
}
// Assign handleMouse to mouse movement events
document.onmousemove = handleMouse;