Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom scroll-bar for body on bootstrap 3

I try to use best solution for bootstrap custom scroll-bar but so far nothing special:| I want to be able to replace default browser scroll-bar on body and inside on other elements like panels or wells, textarea ... I found this plugin and woks just fine but if I want to replace body scroll is not working as in other cases. Am I not doing something right or ... can someone explain me why is not working for <body> or if can just suggest me other plugins except: jQuery slimScroll, malihu-custom-scrollbar-plugin, jScrollPane because I already tested and aren't good for my project.

Here is a small fiddle example

ty

like image 855
RulerNature Avatar asked Mar 25 '14 13:03

RulerNature


People also ask

How do I make my scroll bar only for modal body?

Bootstrap 4.3 added new built-in scroll feature to modals. This makes only the modal-body content scroll if the size of the content would otherwise make the page scroll. To use it, just add the class modal-dialog-scrollable to the same div that has the modal-dialog class.

How do I add a scrollbar in bootstrap?

Add data-spy="scroll" to the element that should be used as the scrollable area (often this is the <body> element). Then add the data-target attribute with a value of the id or the class name of the navigation bar ( . navbar ). This is to make sure that the navbar is connected with the scrollable area.

How do I make content inside modal scrollable?

Use the . modal-dialog-scrollable class to enable scrolling inside the modal.


1 Answers

Ok, I see what you mean now - looks to me like you can't really use this javascript scroll solution on the <body> tag as it gets confused by the hidden parts of the other scrolled elements.

I would suggest wrapping everything in a <div id=bodyDiv>, styling it to use only the available window space and then adding the scrollbar to that to simulate the scroll being on <body>:

http://jsfiddle.net/W4JKM/

like image 89
Starscream1984 Avatar answered Oct 06 '22 20:10

Starscream1984