I am using JQuery Accordion. I have this page here: http://www.hauppauge.com/site/support/support_colossus.html#tabs-6

实际情况是,自动高度加载需要一些时间,在加载之前,内容下方有大量空白.当它最终加载时,高度将扩展到更长,然后捕捉到内容的正确高度.有没有办法做到天衣无缝?我只想能够点击一个手风琴标签,让它平滑地扩展到内容的确切高度.

Update 08/08/2014:

如果您使用的是version 1.9 and higher,请使用heightStyle: "content"(Tarun's回答)

autoHeight: false表示1.8 and lower(iappwebdev的答案)

推荐答案

So why don't you just set autoheight to false?

$( ".selector" ).accordion({ autoHeight: false });

http://jqueryui.com/demos/accordion/#option-autoHeight

EDIT

Looking at your comment:

// Accordion
$("#accordion").accordion({ header: "h3" });
$("#accordion").accordion({ collapsible: true });
$("#accordion").accordion({ autoHeight: false, navigation: true });

你先初始化手风琴,然后再添加更多选项.你为什么这么做?autoHeight的默认值为true,因此每个选项卡都有一个固定的高度.将所有选项放在一次通话中:

// Accordion
$("#accordion").accordion({
    header: "h3",
    collapsible: true,
    autoHeight: false,
    navigation: true 
});



EDIT

关于你的第二条 comments :

Have a look at http://jqueryui.com/demos/accordion/#option-header. You can see that option h3 is set by default, so you don't have to set it in your call.

And you get an answer to your question here: JQuery accordion doesn't work without h3 tags.

通过jQueryAPI来提高知识水平是非常重要的.对于jQuery API,转到http://api.jquery.com/;对于jQuery UI,转到http://jqueryui.com/demos/.如果你还有任何问题,请毫不犹豫地问after你试图解决你的问题,after你做了一些研究.

如果所有这些都回答了你的问题,请将其标记为正确答案.

Jquery相关问答推荐

从克隆的输入中读取数据属性,返回初始输入的值

在 Laravel 中使用 jQuery post 按相关值过滤 Select 选项,如何显示从控制器返回的数据?

如何定位 prism.js 脚本中包含的代码?

JQuery AJAX 成功事件未触发

可以推迟 jQuery 的加载吗?

jQuery 与 javascript?

jQuery.parseJSON 单引号与双引号

在 JavaScript 中解析 URL

如何正确卸载/销毁 VIDEO 元素

在 800px 后在 scrollDown 上显示 div

jQuery.parseJSON 与 JSON.parse

JavaScript / jQuery:测试窗口是否有焦点

jQuery - 用 DIV 跟随光标

jQuery .load() 调用不会在加载的 HTML 文件中执行 JavaScript

复选框值始终为打开

你如何在Javascript中缓存图像

如何从所有元素jquery中删除类

IE8 和 JQuery 的 trim()

jQuery attr 与props ?

在jQuery中,当它们都具有相同的名称时,如何获取单选按钮的值?