Javascript Jquery手风琴选项卡

Javascript Jquery手风琴选项卡,javascript,jquery,wordpress,Javascript,Jquery,Wordpress,如何将“Firstpane”设置为打开,而其他窗格则关闭。。。。 我从这里复制了相同的代码,但在我的上面,一切都是开放的 脚本 <script> $(function() { $("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null}); }); </script> <script> // add new effect to

如何将“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>

$(函数(){
$(“#accordion”).tabs(“#accordion div.pane”{tabs:'h2',effect:'slide',initialIndex:null});
});
//向选项卡添加新效果
$.tools.tabs.addEffect(“幻灯片”,函数(i,完成){
//1.隐藏后,活动窗格具有红宝石背景色
this.getPanes().slideUp().css({backgroundColor:#fff});
//2.窗格显示后,其背景设置为其原始颜色(透明)
this.getPanes().eq(i).slideDown(函数()){
$(this.css({backgroundColor:'transparent'});
//提供的回调必须在效果完成其工作后调用
完成。调用();
});
});

删除此修复我的问题“initialIndex:null”删除此修复我的问题“initialIndex:null”

或者您可以放置initialIndex:0,记住您将使用的数字,指示默认窗格,0是第一个元素,或者您可以放置initialIndex:0,记住您将使用的数字,指示默认窗格,0是第一个元素