简体   繁体   English

jQuery-jScrollPane-动态高度保持固定

[英]JQuery - jScrollPane - Dynamic height stays fixed

I'm trying to use jScrollPane for have a scroll in a dynamic div, but I'm having some troubles... 我正在尝试使用jScrollPane在动态div中进行滚动,但是我遇到了一些麻烦...

Here is my structure 这是我的结构

<div id="DynamicDivHeightAndWidth">
   <div id="Content">
       <div id="TextContent"></div>
   </div>
</div>

I only have this CSS propreties (only for the principal div that must have a dynamic height and a dynamic width) 我只有这个CSS属性(仅适用于必须具有动态高度和动态宽度的主体div)

.DynamicDivHeightAndWidth{
color:#FFF;
float:left;
margin-left:30px;
-webkit-border-radius:20px;
-moz-border-radius:20px;
background-color:#000;
border:solid #FF6C00 3px;
display:none;
z-index:10;
overflow:hidden;
width:21%;
height:21%;}

My jScrollPane is declared like so : 我的jScrollPane声明如下:

$(function()
        {
            $('#Content').each(
                function()
                {
                    $(this).jScrollPane(
                        {
                            showArrows: $(this).is('.arrow')
                        }
                    );
                    var api = $(this).data('jsp');
                    var throttleTimeout;
                    $(window).bind(
                        'resize',
                        function()
                        {
                            if ($.browser.msie) {
                                // IE fires multiple resize events while you are dragging the browser window which
                                // causes it to crash if you try to update the scrollpane on every one. So we need
                                // to throttle it to fire a maximum of once every 50 milliseconds...
                                if (!throttleTimeout) {
                                    throttleTimeout = setTimeout(
                                        function()
                                        {
                                            api.reinitialise();
                                            throttleTimeout = null;
                                        },
                                        50
                                    );
                                }
                            } else {
                                api.reinitialise();
                            }
                        }
                    );
                }
            )

        });

Now my problem is that my "DynamicDivHeightAndWidth" have a dynamic width, BUT the height stay in fix and I don't know why ? 现在我的问题是我的“ DynamicDivHeightAndWidth”具有动态宽度,但是高度保持固定,我不知道为什么?

I've tried many issues, but still doesn't work... 我已经尝试了许多问题,但仍然无法正常工作...

Thank for your help ^^ 感谢您的帮助^^

您是否已将html和body高度设置为100%,也只需检查CSS,即可将动态div定义为类而不是id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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