我需要切換內容的幫助 - 在幾列中,我做了隱藏的內容,它顯示在按鈕點擊。 (在窗格生物文本點擊BTN-切換顯示內容)切換隻顯示點擊的內容 - 隱藏其他
<div class="wpb_wrapper">
<div class="bio"><a class="btn-show">Arnold Schwarzenegger,Chairman, CEO & Partner</a></div>
<p class="bio-text" style="display: none;">Arnold Alois Schwarzenegger (born July 30, 1947) is an Austrian-American actor, model, producer, director, activist, businessman, investor, writer, philanthropist, former professional bodybuilder, and politician. Schwarzenegger served two terms as the 38th Governor of California from 2003 until 2011.</p>
</div>
現在我有4個包裝這樣的。 它通過jQuery實現。問題是,目前情況如何,它支持所有的切換活動。我需要重新格式化我的代碼,只允許1被激活(在其他隱藏單擊除點擊一個所有擴展的內容) 下面是一個代碼:
jQuery(document).ready(function ($) {
$('.bio-text').hide();
$('.btn-show').click(function() {
// $this determines which button clicked on
var $this = $(this);
// grab the text that is NEXT to the button that was clicked on
//var theText = $this.next();
var theText = $this.parent().next(".bio-text");
// Change the text of the button depending on if the text is hidden
theText.slideToggle(500);
$this.parent().toggleClass('highlight');
});
});
所以這是工作,但允許所有窗格中打開在同一時間。 我需要幫助才能使這個排他性的內容窗格顯示出來。
在此先感謝
請添加滿標記,以便我們提供幫助。 – Ionut
你想讓手風琴作出來嗎 –