简体   繁体   中英

Allow height% with jQuery scrollbar

I am using the Malihu custom content scroller with automatic scrolling. So far, I basically am experimenting with it. I noticed when I take the height of the scrolling div and use a percentage instead of a fixed amount in px, it expands the div the entire height of the scroll area (off the screen).

I'm literally just taking the code from this GitHub location then opening the file "auto_scrolling_example.html".

Then in the <style> section of the header, I'm simply changing .content: height:500px to .content: height:50% .

Does anyone know why this doesn't work and/or have a good workaround for it?

When you specify the height or width as a percentage, that's a percentage with respect to the element's parent.

If the parent doesn't have any height or width inner children will not work in percentage.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM