【问题标题】:Jquery Accordion tabsJquery 手风琴标签
【发布时间】:2010-03-31 18:51:05
【问题描述】:

如何默认“第一窗格”设置为打开而其他窗格关闭.... 我从这个 sample 复制了相同的代码,但在我的所有东西都是开放的 view here

脚本

<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>

【问题讨论】:

    标签: javascript jquery wordpress


    【解决方案1】:

    删除这个解决了我的问题 "initialIndex: null"

    【讨论】:

      【解决方案2】:

      也可以放 initialIndex: 0 ,记住要使用的数字,表示默认窗格,0是第一个元素

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多