0

Let's say I have two divs on a page like this:

<div style="width:300px;height:100px;overflow:hidden">
  <div style="width:3000px;height:100px">
  some content
  </div>
</div>

and let's assume that the outer div is positioned somewhere in the middle of the page.

Is there a possibility to "map" the global document scrollbar to that div so it's possible to use the mouse's / trackpad's horizontal scrolling feature to move that inner div to left and right?

I hope it's clear what I am trying to do...

1 Answer 1

0

I'm not sure it's possible to re-map the scrollbar's effected area. However, you might be able to achieve the same visual effect by making a fixed position div (position:fixed;), and keeping it on top of the one that needs to scroll left and right. You'd have to make the two divs siblings instead of parent>child, which hopefully isn't a deal-breaker.

This way, the page's scrollbar would effect the 'child' div just as it normally would, while allowing the other one to remain locked in place.

Hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.