簡體   English   中英

在“常見問題”頁面上的問題下,答案消失了

[英]Answers collapsed under the questions on the FAQs page

我有一個“常見問題解答”頁面(純HTML)。 問題具有CSS類.pageSubtitle,而答案具有兩個類:.p1和.p2。 示例是:

<p class="pageSubtitle">Which Award should I apply for?</p>
<p class="p1">Centers that wish to be recognized for adhering to Guidelines and their Quality Programs and their Processes should apply for <span style="font-weight: bold;">The Center of Excellence in Life Support Award.</span> 
These programs must meet or exceed criteria in the following categories:
</p>

<p class="p2">o Systems Focus</p>
<p class="p2">o Environmental Focus</p>
<p class="p2">o Workforce Focus</p>
<p class="p2">o Knowledge Management</p>
<p class="p2">o Quality Focus</p>
<p class="p2">o Process Optimization</p>
<p class="p2">o Family Focus</p>

在此“常見問題”頁面上,用戶希望將答案折疊在問題下方,當您單擊問題時,答案將顯示在其下方。 我怎樣才能做到這一點? 預先感謝您的任何幫助。

我終於找到了行之有效的解決方案:

<script type="text/javascript"> 
$(document).ready(function(){ 
$('.p1, .p2, .p3, .p4').hide(); 
$('.pageSubtitle').click(function(){ 
$(this).nextUntil('.pageSubtitle').toggle();
 }); 
 }); </script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM