当一排放置多个Accordion组件的时候 点击一个 另外的位置也会偏移。
后来发现是因为使用了style="display:inline-block"导致的。 修改为flat:left就好了 以下是问题代码
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Accordion - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#accordion1" ).accordion({heightStyle:'fill'});
$( "#accordion2" ).accordion({heightStyle:'fill'});
$( "#accordion3" ).accordion({heightStyle:'fill'});
});
</script>
</head>
<body>
<div style="display:inline-block">
<div id="accordion1" style="width:200px; ">
<h3>Section 1</h3>
<div>
<p> ante</p>
</div>
<h3>Section 4</h3>
<div>
<p> Pelleus</p>
</div>
</div>
</div>
<div style="display:inline-block">
<div id="accordion2" style="width:200px; ">
<h3>Section 1</h3>
<div>
<p> ante</p>
</div>
<h3>Section 4</h3>
<div>
<p> Pelleus</p>
</div>
</div>
</div>
<div style="display:inline-block">
<div id="accordion3" style="width:200px; ">
<h3>Section 1</h3>
<div>
<p> ante</p>
</div>
<h3>Section 4</h3>
<div>
<p> Pelleus</p>
</div>
</div>
</div>
</body>
</html>