jQuery tabSlideOut插件动态高度 [英] jQuery tabSlideOut Plugin Dynamic Height

查看:89
本文介绍了jQuery tabSlideOut插件动态高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在我的应用程序 http://www.building58.com/examples中使用此jQuery插件/tabSlideOut.html

一切正常,除了滑出面板的高度不固定-使用Ajax请求填充可能长短的项目列表-顶部的下拉菜单可过滤此列表根据状态,高度会发生变化.

It all works well except that the height of my slide out panel is not fixed - it uses an Ajax request to populate a list of items which could be of any length - a drop down at the top allows this list to be filtered by status so the height will change.

我可以在CSS上添加一个可以正常工作的高度,但是由于它可以是任何高度,因此并不能真正解决问题,但是由于列表是动态填充的,因此当我将高度保留在CSS之外时,将看不到任何内容,显示太小.

I can add a height to the CSS which works but as it could be any height this doesn't really solve the problem but because the list is populated dynamically, when I leave the height out of the CSS it sees no content and displays too small.

有什么方法可以在更改内容时调整面板的大小?

Is there a way to resize the panel when the content changes?

推荐答案

如果其他人遇到此问题,我可以通过稍微修改JavaScript来解决-仅在第一次检查尺寸时才对它进行调整,这就是为什么它没有调整大小的原因.

In case anyone else has this problem I solved it by modifying the JavaScript slightly - the dimensions were only being checked the first time which is why it did not resize.

我进行了更改,因此每次都会创建一个新对象

I made this change so it would create a new object each time

var properties = function(){
    return {
        containerWidth: parseInt(obj.outerWidth(), 10) + ‘px’,
        containerHeight: parseInt(obj.outerHeight(), 10) + ‘px’,
        tabWidth: parseInt(settings.tabHandle.outerWidth(), 10) + ‘px’, 
        tabHeight: parseInt(settings.tabHandle.outerHeight(), 10) + ‘px’
    }
};

然后我从

properties.attribute

properties().attribute

现在,只要更新内容,高度就会调整.

And now the height adjusts whenever the content is updated.

这篇关于jQuery tabSlideOut插件动态高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆