mardi 22 août 2017

How to make global scrollbar apply to only one element

I have a beautiful dashboard made with Bootstrap, with an alerts list on the right side. This alerts list is the only thing that scrolls, and I really want to apply the scrolling of the page to just this element.

I found this answer with someone asking something similar a few months ago, but the solution given was just to disable the page scrollbar and enable a scrollbar for the element. What I'm looking to do is keep the page scrollbar, but make it scroll only the one element.

Solutions I've Tried:

  • Position fixed - Completely and irrevocably breaks Bootstrap

  • Whole page position fixed and window.scrollTo() for element - Ugly and inconsistent

Is there a good way of making the page scrollbar apply to one specific element, where CSS position: fixed can't be used on the element without breaking the page?




Aucun commentaire:

Enregistrer un commentaire