简体   繁体   English

jQuery UI标签在顶部和底部

[英]jquery ui tab at both top and bottom

I would like to have a Jquery UI tab with top and button menu function, is it possible to do that ? 我想要一个具有顶部和按钮菜单功能的Jquery UI选项卡,可以这样做吗? (the content are loaded via ajax ,what i mean is the top tab and bottom tab both at the same time.) (通过ajax加载内容,这是同时显示顶部标签和底部标签的意思。)

<script type="text/javascript" charset="utf-8">
    $(function() {
        $( "#tabs" ).tabs({                 
            ajaxOptions: {
                error: function( xhr, status, index, anchor ) {
                    $( anchor.hash ).html(
                        "Couldn't load this tab. We'll try to fix this as soon as possible. " +
                        "If this wouldn't be a demo." );
                }
            },
            cookie: {
                // store cookie for a day, without, it would be a session cookie
                expires: 1
            }
        });
});
</script>
<div id="tabs"> 
    <ul id="top"> 
       <li><a href="top1.php">top 1</a></li> 
       <li><a href="top2.php">top 2</a></li> 
    </ul> 
    <ul id="bottom"> 
       <li><a href="bottom.php">bottom 1</a></li> 
       <li><a href="bottom.php">bottom 2</a></li> 
    </ul> 
</div>

Thank you in advance! 先感谢您!

I am a bit confused about what you want to achieve, but if you are trying to make similiar layout as I am in jQuery UI tabs - how to change tab position ,then if you dont mind having the tabs layout of fixed height, then you can simply move the tabs by css as I did here http://jsfiddle.net/L6QjK/2/ 对于要实现的目标,我有点困惑,但是如果您要像在jQuery UI选项卡中一样进行类似的布局-如何更改选项卡位置 ,那么如果您不介意使用固定高度的选项卡布局,那么您可以像我在这里一样简单地通过CSS移动标签页http://jsfiddle.net/L6QjK/2/

If you DO mind the fixed height, my only idea so far is to create layout with one control panel, than add some <div> looking as control panel and move some tabs after initialization from the code by usinge something like this: 如果您一定要注意固定的高度,那么到目前为止,我唯一的想法是使用一个控制面板创建布局,而不是添加一些<div>作为控制面板,并在代码初始化后通过使用以下方法移动一些选项卡:

$("#yourFakeControlPanel").append($(".ui-tabs-nav").find("#yourTab"));

$(".ui-tabs-nav").find("#yourTab").remove();

This was working when all the tabs were static, but I have ran to some errors, when adding new tabs dynamicaly, so consider this as a hint not as an exact answer 当所有选项卡都是静态的时,这是可行的,但是在动态添加新选项卡时遇到了一些错误,因此请将此作为提示,而不是确切的答案

I think i have finaly found your answer. 我想我终于找到了你的答案。 Look to my post, I have written there how to make tabs on the top and bottom same time jQuery UI tabs - how to change tab position 看我的帖子,我在那里写了如何在顶部和底部同时创建jQuery UI选项卡-如何更改选项卡位置

and if zou find this helpful, mark this as an answer to lead others to the right sollution 如果zou觉得有帮助,请将其标记为引导他人寻求正确解决方案的答案

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

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