簡體   English   中英

jQuery手風琴選項卡

[英]Jquery Accordion tabs

我如何默認將“ Firstpane”設置為打開,而其他設置為關閉...。我從該示例復制了相同的代碼,但在我看來,所有內容都是打開的

腳本

<script>
$(function() { 

$("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
});
</script>

<script>

// add new effect to the tabs
$.tools.tabs.addEffect("slide", function(i, done) {

    // 1. upon hiding, the active pane has a ruby background color
    this.getPanes().slideUp().css({backgroundColor: "#fff"});

    // 2. after a pane is revealed, its background is set to its original color (transparent)
    this.getPanes().eq(i).slideDown(function()  {
        $(this).css({backgroundColor: 'transparent'});

        // the supplied callback must be called after the effect has finished its job
        done.call();
    });
});
</script>

刪除此問題,解決了我的問題“ initialIndex:null”

或者,您可以將initialIndex:0記住要使用的數字,指示默認窗格,0是第一個元素

暫無
暫無

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

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