简体   繁体   中英

jQuery UI tabs and tabs content in diffrent places

UI tabs work like this:

$( "#tabs" ).tabs();

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">tab 1</a></li>
        <li><a href="#tabs-2">tab 2</a></li>
    </ul>
    <div id="tabs-1">
    </div>
    <div id="tabs-2">
    </div>
</div>

Need to do somethig like this:

$( "#tabs" ).tabs();

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">tab 1</a></li>
        <li><a href="#tabs-2">tab 2</a></li>
    </ul>
</div>

<div id="tabs-content">
    <div id="tabs-1">
    </div>
    <div id="tabs-2">
    </div>
</div>

So tabs and tab content in different divs.

Is it possible?

Yes its is possible

Please check this link , and click links

http://jsfiddle.net/YJdVE/1/

code

$(function() {
$("#tabs ul li").click(function() {
$("#tabs-content div").hide();
$('#tabs-content div:eq('+($(this).index())+')').show();
});
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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