1

My English is not good and I'm new to CSS.

The scroll bar is taking up space. I want it not to happen.

Because the fixed navigation menu bar center is changing. The size of background pictures changes. It is shrinking. When the scroll bar disappears, the dimensions change again.

How do I isolate the Scrollbar element?

Psuedo code: Scrollbar Like {Fixed}? Is it possible?

For the dimensions of the other elements not to be disturbed.

https://codepen.io/ariona/pen/geFIK

For example, there is an example on this link. When the div is moving, the scroller is visible. And the size of the background image changes. If there is a navigation menu, its size also changes. Their dimensions should not change. (When overflow:auto) How is this provided?

Thank you...

Ayse 98
  • 65
  • 10
  • 1
    Welcome to StackOverflow! In order for us to help you better, please update your question so that it shows all **relevant code** in a [**minimal, complete, and verifiable example**](http://stackoverflow.com/help/mcve). It would also be helpful if you could let us know what you have tried so far to solve your problem. For further information, please refer to the help article regarding [**how to ask good questions**](http://stackoverflow.com/help/how-to-ask), and take the [**tour of the site**](http://stackoverflow.com/tour) :) – Obsidian Age May 29 '17 at 22:32
  • is this what you're looking for? https://stackoverflow.com/questions/24700184/how-do-i-force-a-vertical-scrollbar-to-appear – Michael Coker May 29 '17 at 22:32
  • Hello. The scrollbar should appear automatically. While the scrollbar is there, the dimensions of the other elements should not change. – Ayse 98 May 29 '17 at 22:36
  • https://codepen.io/ariona/pen/geFIK For example, there is an example on this link. When the div is moving, the scroller is visible. And the size of the background image changes. If there is a navigation menu, its size also changes. Their dimensions should not change. How is this provided? – Ayse 98 May 29 '17 at 22:43
  • does this fix it? https://codepen.io/mcoker/pen/OmeXBR – Michael Coker May 29 '17 at 22:48
  • (When overflow:auto) When the scrollbar is visible, the width values (width max) should not change. – Ayse 98 May 29 '17 at 22:56

1 Answers1

2

If you really need to keep the scrollbar, this plugin does it nicely: https://github.com/inuyaksa/jquery.nicescroll

OR

If you don't mind losing the scrollbar, you might want to do something like:

/* This will keep the original width of the background image */

body {
    overflow: hidden;
  }

If you want to keep the horizontal scrollbar and lose the vertical scrollbar:

body {
  overflow-x: auto;
  overflow-y: hidden;
}