简体   繁体   English

JQuery:我可以在同一页面中有2个选项卡吗?

[英]JQuery : Can i have 2 tabs in the same page?

i'm trying to have 2 tabs in the same page, but the first works great, and the second doesn't work at all. 我试图在同一页面上有两个标签,但第一个效果很好,第二个根本不起作用。

It is possible to have 2 tabs in the same page, if yes, how can i manage that? 在同一页面中可以有2个选项卡,如果是,我该如何管理?

Both have the same code ... example : $('#tab1').tabs(); 两者都有相同的代码...例如:$('#tab1')。tabs(); and the other $('#tab2').tabs(); 和其他$('#tab2')。tabs();

Thank you 谢谢

My HTML: 我的HTML:

<section>
<div id="radioprog">
    <h2 class="fire">R&aacute;dio</h2>
    <ul id="radio-nav">
        <li><a class="dia" href="#seg">2ª</a></li>
        <li><a class="dia" href="#ter">3ª</a></li>
    </ul>

    <div id="seg" class="programacao">
        seg
    </div>


    <div id="ter" class="programacao">
        ter
    </div>

</div>      
</section>

<section id="info-tab" style="width:325px; margin-top:3px;">
<div id="tabs">
    <ul>
        <li><a href="#comentados">+ Comentados</a></li>
        <li><a href="#lidos">+ Lidos</a></li>
    </ul>

    <div id="comentados">
        <ul>
            <li><a href="#nowhere" title="Lorum ipsum dolor sit amet">Lorem</a></li>
            <li><a href="#nowhere" title="Aliquam tincidunt mauris eu risus">Aliquam</a></li>

        </ul>
    </div>

    <div id="lidos">

        <ul>
            <li><a href="#nowhere" title="Lorum ipsum dolor sit amet">Lorem</a></li>
            <li><a href="#nowhere" title="Aliquam tincidunt mauris eu risus">Aliquam</a></li>
        </ul>
    </div>
</div>      
</section>

You can have several tabs (nested, on the same level, etc). 您可以有多个选项卡(嵌套,在同一级别上等)。

You run into issues when they share the same IDs. 当他们共享相同的ID时会遇到问题。

See: 看到:

http://jsbin.com/eqivo/edit http://jsbin.com/eqivo/edit

I really need to rest, it is working... the problem was that the text was the same and i didn't saw that. 我真的需要休息,它正在工作......问题是文本是一样的,我没有看到。

Sorry. 抱歉。

Solved 解决了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM