Home > Enterprise >  How to make div scroll horizontal when scrolling?
How to make div scroll horizontal when scrolling?

Time:10-24

I have top mini navigation I want to scroll it horizontally. when someone scrolls vertically downward. so that they can view the overflowing text in the mini navigation.

CodePudding user response:

You can use wheel event on your element for example

const element = document.querySelector('#parent-element');
element.addEventListener('wheel', (e) => {
    element.scrollLeft  = e.deltaY);
})
  • Related