Jquery选项卡:使用url访问非默认选项卡

时间:2016-05-28 20:10:37

标签: javascript jquery tabs

我正在使用jquery选项卡创建3个选项卡,以下是我的html代码

    <div id="sections" class="sections">
      <ul class="sections" role="tablist">
        <li class="active" role="presentation">
          <a href="#user" aria-controls="user" role="tab" data-toggle="tab">User</a>
        </li>
        <li role="presentation">
          <a href="#setting" aria-controls="setting" role="tab" data-toggle="tab">Setting</a>
        </li>
        <li role="presentation">
          <a href="#customer" aria-controls="customer" role="tab" data-toggle="tab">Customer</a>
        </li>           
      </ul>

      <div class="tab-content">
        <section id="user" class="panel" role="tabpanel">
            Some content is here
        </section>

        <section id="setting" class="panel" role="tabpanel">
            Some content is here
        </section>

        <section id="customer" class="panel" role="tabpanel">
            Some content is here
        </section>
      </div>

并启动标签,如

$(&#39;#部分&#39)片();

现在,当我在url端使用/#设置访问页面时,它会先显示“用户”选项卡,然后再显示“设置”选项卡。我怎么能避免这个?

0 个答案:

没有答案