function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
How can I make the scroll bar from the main div (#core) scale to the content within it? The scrollbar doesn't change in size regardless of the number of divs within in it that have had their display property changed from none to block.
I'm not sure if that is your actual code or an example, but you need to change the id from '#core, #id1' etc to the following: '<div id="core"></div>' etc. As far as the CSS side of things, the core div should be given a defined height/width etc and the CSS properties should be set to 'overflow : auto;'. This will allow for you to have the scrolling div with divs inside.
I believe it's because of the mCustomScrollbar div, which is parent of #core. It calculates the content height only once on plugin load. But after that, you make another block part visible, which causes it to resize, but the mCustomScrollbar doesn't know about it. There is an advanced option,
advanced: { updateOnContentResize : true }
which could check for the content resize dynamically, but the authors don't recommend it, probably for performance reasons. Maybe you can add another callback for the "Show Discussion" click, which would call
You're welcome. I used the mCustomScrollbar in some project recently and encountered a similar problem. However I went with the "updateOnContentResize" approach and nothing terrible happened.
Bookmarks