【问题标题】:JQuery - jScrollPane - Dynamic height stays fixedJQuery - jScrollPane - 动态高度保持固定
【发布时间】:2011-10-27 16:04:03
【问题描述】:

我正在尝试使用 jScrollPane 在动态 div 中滚动,但我遇到了一些麻烦...

这是我的结构

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

我只有这个 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%;}

我的 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();
                            }
                        }
                    );
                }
            )

        });

现在我的问题是我的“DynamicDivHeightAndWidth”具有动态宽度,但高度保持不变,我不知道为什么?

我尝试了很多问题,但仍然无法正常工作......

感谢您的帮助^^

【问题讨论】:

    标签: jquery css jscrollpane javascript


    【解决方案1】:

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

    【讨论】:

    • *div 有一个 id,它是类名 :-) 我忘记在发布之前更改它 :-)
    • 感谢 jsFiddle,但仍然无法使用配置 :-( 它对您有用吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-02
    • 2012-04-26
    • 1970-01-01
    • 2018-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多