简体   繁体   English

jQuery-克隆选项卡,但保持原始隐藏?

[英]JQuery - Clone Tabs but keep original hidden?

I am cloning a JQuery UI Dialog with Nested UI Tabs. 我正在克隆带有嵌套UI选项卡的JQuery UI对话框。 I need to hide the original Tabs elements (or have them offscreen), but still be able to clone and show the cloned Tabs. 我需要隐藏原始的Tabs元素(或使其不在屏幕上),但仍然能够克隆并显示克隆的Tabs。 Any ideas? 有任何想法吗?

<div class="dialog">
                <div class='tabs'>
                    <ul>
                        <li data-type="presentations"><a href="#presentations">Presentations</a>
                        </li>
                        <li data-type="outcomes"><a href="#outcomes">Learning Outcomes</a>
                        </li>
                        <li data-type="conditions"><a href="#conditions">Core Conditions</a>
                        </li>
                    </ul>
                    <div id="presentations"></div>
                    <div id="outcomes"></div>
                    <div id="conditions"></div>
                </div>
            </div>
      <button id='button'>Create Tabs</button>

and

//$('.tabs').hide();

$('#button').click(function() {
  $('.dialog').clone().appendTo('body').removeClass( 'dialog' ).tabs();
});

Fiddle 小提琴

If this is not feasible, then I guess a fall back would be to create the tabs dynamically. 如果这不可行,那么我猜一个后退是动态​​创建选项卡。

Add display: none to the class dialog in your .css file: display: none添加到.css文件中的类dialog

.dialog {
    display: none;
}

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

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