我有以下 Accordion :
<div id="accordion">
<h3>Section 1</h3>
<div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />hello
</div>
<h3>Section 2</h3>
<div>
</div>
<h3>Section 3</h3>
<div>
</div>
<h3>Section 4</h3>
<div>
</div>
</div>
这是 jquery:
$(function() {
$( "#accordion" ).accordion({
fillSpace:true
});
});
$(window).resize(function(){
$("#accordion").accordion("resize");
});
在 Firefox 中一切正常,但在 Chrome 中,即使存在内容溢出,“Section 1”div 也不会添加滚动条。我必须在滚动条显示之前(在 div 内)手动调整窗口大小。 Firefox 会检测到溢出并默认显示滚动条。有人知道发生了什么吗?我什至不介意强制滚动条始终显示,但我什至无法将任何样式应用于 div 或 Accordion 。
最佳答案
您应该将 fillSpace: true
替换为 heightStyle : 'fill'
,因为它是 deprecated 。
编辑
$(function() {
$( "#accordion" ).accordion({
heightStyle: 'fill',
autoHeight: false
});
});
CSS:
.ui-accordion .ui-accordion-content{ overflow:auto !important; }
关于jQuery Accordion - div 在 Chrome 中不滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17299269/