【问题标题】:Jquery-Tools Tabs - Need a specific tab to load two divs onClickJquery-Tools 标签 - 需要一个特定的标签来加载两个 div onClick
【发布时间】:2012-02-09 22:48:49
【问题描述】:

我有三个使用 jquery 工具选项卡的选项卡。每个选项卡触发不同的 div。但是,我需要第二个和第三个选项卡在不同的位置触发两个 div(主要。我尝试使用选项卡索引无济于事。所以,问题是,我怎样才能让第二个和第三个选项卡触发两个 div?

我回到了标签的基本加载方法。

<script>
$(function() {
    $("ul.tabs").tabs("div.panes > div");
});
</script>

HTML如下:

<div id="search-wrapper">
    <div id="navcontainer">
        <ul class="tabs">
            <li><a href="#">Tab 0</a></li>
            <li><a href="#">Tab 1</a></li>
            <li><a href="#">Tab 2</a></li>
        </ul>
    </div>

    <input type="text" name="searchinput" id="searchinput" size="30">
    <input type="submit" value="Search" />  

    <!-- I need this div to open onClick of Tab 1 and Tab 2-->
    <div style="display: none" id="categoryselector">
        This will contain specific selectors for the search.
    </div>
</div><!--end of search-wrapper-->


<!-- Below are the main tabs that open correctly -->
<div class="panes">
    <div class="tabcontent">Tab 0</div>
    <div class="tabcontent">Tab 1</div>
    <div class="tabcontent">Tab 2</div>
</div>

感谢任何帮助。

【问题讨论】:

    标签: jquery tabs jquery-tools


    【解决方案1】:

    查看他们的文档

    http://flowplayer.org/tools/tabs/index.html

    绑定到标签的点击事件。

    $(function() {
        $("ul.tabs").tabs("div.panes > div", {
             onClick: function(event, tabIndex) {
                if (tabIndex == 1 || tabIndex == 2) { 
                    $('#categoryselector').show(); 
                }
             }
        });
    });
    

    【讨论】:

    • 这是正确的轨道。我最终使用的实际代码是 $(function() { $("ul.tabs").tabs("div.panes > div", { onClick: function(event, tabIndex) { if (tabIndex == 0) { $('#categoryselector').hide(); } if (tabIndex == 1 || tabIndex == 2) { $('#categoryselector').show(); } } }); });跨度>
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-31
    • 1970-01-01
    • 2015-11-10
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多