ngx-slimscroll icon indicating copy to clipboard operation
ngx-slimscroll copied to clipboard

Generated div height not resizable

Open l-ollie opened this issue 8 years ago • 8 comments

I use the slimscroll in a dive that takes up different height because the element above can be collapsed. On the generated div with class "slimscroll-wrapper" I see it's got a fixed height. In Inspector mode i change the height to 100% and this fixed the problem by taking up the available space.

How can I take the div with class "slimscroll-wrapper" take the available height when resized?

l-ollie avatar Mar 29 '17 09:03 l-ollie

hi @l-ollie. we need to find a way to detect change on height, but this is harder that it sounds. the resize event only exists on window and some contributor already tried with MutationObserver which doesn't work as expected. if you have any suggestions they are welcome.

jkuri avatar Mar 29 '17 10:03 jkuri

Nice! You changed to 100% height. I think this is a nice fix if the container resize a bit. After some tests I found out that the scroll bar doesn't resize. If the size changes a bit, it's absolutely not a problem. But if it's a huge change in size, the scroll bar gives a little confusion because it doesn't represents the scrolling position. After a little bit of fiddling around, I think, if you change the fixed height of the slimscroll-bar aswell into a % this would solve a huge part of the problem.

Maybe its an idea to calculate the height of the slimscroll-bar in % instead of fixed px so its scales better?

l-ollie avatar Mar 30 '17 09:03 l-ollie

Yesterday I updated to Angular 4 and I noticed that the height of the generated div is set to a fixed height again. I would love for it be relative again!

l-ollie avatar Apr 06 '17 09:04 l-ollie

Can confirm, using angular 4 and angular flex-layout doesn't help my div resize after loading data.

austinbhodge avatar Apr 07 '17 01:04 austinbhodge

I made it work in my project with this commit Maybe, it'll be helpfull for somebody.

DDroll avatar Apr 14 '17 23:04 DDroll

@DDroll can you make a PR please?

jkuri avatar Apr 14 '17 23:04 jkuri

@jkuri i'm not sure, that it'll work in enveronment, differing from mine. I think you need just this part

@HostListener('window:resize', ['$event'])
    onResize() {
     this.getBarHeight()
 }

DDroll avatar Apr 14 '17 23:04 DDroll

no problem, please make a PR, I checked your commit and cannot do any harm only good 👍

jkuri avatar Apr 14 '17 23:04 jkuri