我在对话框中有一个 jQuery 选项卡小部件。在此 Fiddle中首次单击 Advisers 图像时,对话框和选项卡小部件显示正常。但是,如果关闭对话框并再次单击图像,则会呈现对话框,但选项卡小部件不会呈现。
我认为这与toggle()
选项卡小部件上使用的方法有关,但如果我删除该方法,选项卡小部件将永远不会显示。几乎就像我需要在对话框关闭时“重新初始化”页面状态,以便在第二次和随后单击 Adviser 图像时呈现选项卡对话框(请原谅我在这里与 UI 术语搏斗,我是服务器侧编码器)。
任何人都可以给我一个指针,好吗?
HTML
<a href="#" id="advisers-image">
<div class="circle hovershadow advisers advisers-box-shadow text">Professional
advisers</div>
</a>
<a href="#" id="industry-image">
<div class="circle hovershadow industry industry-box-shadow">Industry</div>
</a>
<div style="clear: both;"></div>
<div id="advisers-dialog" class="dialog">
<div id="tabs">
<ul>
<li><a href="#tabs-1">Law firms</a></li>
<li><a href="#tabs-2">Accounting and audit firms</a></li>
<li><a href="#tabs-3">Management consultants and economists</a></li>
</ul>
<div id="tabs-1">
<p>Law firm text goes here.</p>
</div>
<div id="tabs-2">
<p>Accounting and audit firm text goes here.</p>
</div>
<div id="tabs-3">
<p>Management consultants and economists text goes here.</p>
</div>
</div>
</div>
<div id="industry-dialog" class="dialog" title="Industry">Industry
text goes here</div>
Javascript
<script type="text/javascript">
$( "#tabs" ).tabs().hide();
</script>
<script type="text/javascript">
$( "#industry-dialog" ).dialog({ autoOpen: false });
$( "#industry-image" ).click(function() {
$( "#industry-dialog" ).dialog( "option", "modal", true );
$( "#industry-dialog" ).dialog( "option", "height", "auto" );
$( "#industry-dialog" ).dialog( "option", "width", 700 );
$( "#industry-dialog" ).dialog( "open" );
});
</script>
<script type="text/javascript">
$( "#advisers-dialog" ).dialog({ autoOpen: false });
$( "#advisers-image" ).click(function() {
$( "#advisers-dialog" ).dialog( "option", "modal", true );
$( "#advisers-dialog" ).dialog( "option", "height", "auto" );
$( "#advisers-dialog" ).dialog( "option", "width", 700 );
$( "#advisers-dialog" ).dialog( "open" );
$( "#tabs" ).tabs( "option", "heightStyle", "content" );
$( "#tabs" ).tabs( 'select', 0 );
$( "#tabs" ).toggle();
});
</script>