[英]How can I prevent the answers of the questions from overlapping the other accordion?
將FAQ的h3標記的ID設置為“ h3-faq”,以使ready函數中的以下代碼可以解決這個問題:
$(document).ready(function () {
$("#general-questions")
.accordion({ collapsible: true, active: false, autoHeight: false })
.bind('accordionchangestart',function(event,ui){
$('#h3-faq').animate({paddingTop: ui.newContent.height()}, 300);
});
$("#accordion")
.accordion({ collapsible: true, active: false });
});
單擊后,這將在FAQ h3的頂部添加適當的填充。 注意,我還設置了autoHeight: false
否則每個內容部分的高度將設置為最大內容部分的高度,並將FAQ頭向下移動太多。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.