• Nunc tincidunt
  • Proi" />
    • Nunc tincidunt
    • Proi" />
      • Nunc tincidunt
      • Proi"/>
        DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        How to connect several jquery tabs?

        132 Views Asked by user2285576 At 23 August 2013 at 17:07 2025-12-04T08:08:30.456000

        See the example here - http://jsfiddle.net/d1st/KyWqR/5/

        <div id="tabs">
          <ul>
            <li><a href="#tabs-1">Nunc tincidunt</a></li>
            <li><a href="#tabs-2">Proin dolor</a></li>
            <li><a href="#tabs-3">Aenean lacinia</a></li>
          </ul>
          <div id="tabs-1">
            <p><strong>Click this tab again to close the content pane.</strong></p>
            <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
          </div>
          <div id="tabs-2">
            <p><strong>Click this tab again to close the content pane.</strong></p>
            <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
          </div>
          <div id="tabs-3">
            <p><strong>Click this tab again to close the content pane.</strong></p>
            <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
          </div>
        </div>
        <div id="tabs2">
          <ul>
            <li><a href="#tabs-1">Nunc tincidunt</a></li>
            <li><a href="#tabs-2">Proin dolor</a></li>
            <li><a href="#tabs-3">Aenean lacinia</a></li>
          </ul>
          <div id="tabs-1">
            <p><strong>Click this tab again to close the content pane.</strong></p>
            <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
          </div>
          <div id="tabs-2">
            <p><strong>Click this tab again to close the content pane.</strong></p>
            <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
          </div>
          <div id="tabs-3">
            <p><strong>Click this tab again to close the content pane.</strong></p>
            <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
          </div>
        </div>
        
        
        
        $(function () {
            $("#tabs, #tabs2").tabs({
                collapsible: true,
                hide: 'blind', 
                show: 'blind',
                active: false,
                autoHeight: false
            });
        });
        

        This is two separated tab-containers (two different rows). This is what I need, but I want to make so:

        if I open tab in second row, then tab in first row should close. As if i open/close tabs in same row (in same container).

        How can i do it?

        Thaks for your answers.

        jquery jquery-ui tabs jquery-ui-tabs jquery-tabs
        Original Q&A
        2

        There are 2 best solutions below

        0
        user2285576 user2285576 On 02 September 2013 at 14:48 BEST ANSWER

        I have my own decision!

            var a;
        $("#tab-main-block > div").tabs({
            collapsible: true,
            hide: 'blind',
            show: 'blind',
            active: false,
            autoHeight: false
        });
        $("#tab-main-block > div ul li").click(function () {
            $("#tab-main-block > div ul li").not(this).attr('aria-selected','false');
            $("#tab-main-block > div ul li").not(this).attr('class','ui-state-default ui-corner-top');
            a = $(this).parents().eq(1);
            $("#tab-main-block > div").not(a).children().not("ul").slideUp(); 
        });
        
        1
        SarathSprakash SarathSprakash On 23 August 2013 at 17:54

        DEMO

        Try this

        $(function () {
            var a;
            var b;
            $("#tabs, #tabs2").tabs({
                collapsible: true,
                hide: 'blind',
                show: 'blind',
                active: false,
                autoHeight: false
            });
            $("#tabs ul li").click(function () {
               a=$(this);
                b.attr('aria-selected','false');
                b.attr('class','ui-state-default ui-corner-top');
               $("#tabs2").children().not("ul").slideUp();
            });
             $("#tabs2 ul li").click(function () {
                 b=$(this);
                 a.attr('aria-selected','false');
                 a.attr('class','ui-state-default ui-corner-top');
             $("#tabs").children().not("ul").slideUp();
            });
            });
        

        Hope this helps,Thank you

        Related Questions in JQUERY

        • How to sort these using Javascript or Jquery Most effectively
        • Ajax jQuery firing multiple time display event for the same result
        • .hover() seems to overwrite .click()
        • Check for numeric value with optional commas javascript
        • Extending Highmaps Side Effect
        • Array appending after each onclick and loop in javascript
        • how can i append part of a table based on how many tr it has?
        • Play multiple audio files in a slider
        • Remove added set of rows
        • Access property of an object of type [Model] in JQuery
        • AJAX PHP - Reload div after submit
        • proengsoft/laravel-jsvalidation ReferenceError: jQuery is not defined
        • when a checkbox is checked how to display a different hidden element using javascript
        • Get jquery error Uncaught RangeError: Maximum call stack size exceeded
        • Removing only the closest thead on table filtering

        Related Questions in JQUERY-UI

        • Uncaught TypeError: undefined is not a function
        • Stop siblings replacing order of canceled element with jQuery-ui
        • jQuery mobile Multiselect doesn't update selected attribute
        • jQuery autocomplete display worng search item
        • List of conflicts between bootstrap and jquery-ui?
        • Creating boundries in JQuery/javascript
        • Having trouble focusing on the TAB that I was currently working on
        • How can i show a jquery menu which opens from right to left side?
        • Can't toggle from right to left Jquery
        • undefined new items appear while reordering a list with ui-sortable and angularJS
        • Jquery Mobile: Horizontal Buttons, fill container
        • Is it possible to override defined options of the jQuery-ui sortable widget?
        • Quick way to clear only option available list on a multiselect with jQuery?
        • How to inject html into iframe, and display inside jquery-ui dialog
        • Show embedded select box on overflow, out of popup container

        Related Questions in TABS

        • SWT CTabFolder doesn't display when running from eclipse
        • Composite Server Templates tabs
        • Preference Screen in SlidingTabLayout
        • Android: Table swipe in fragment goes too far
        • Is it possible for chrome to nest tabs within a tab?
        • Same Tab content over three different pages, how to active the coreesponding tabs according to the page id wordpress
        • How to add a WebView as a content to a tab in JavaFX?
        • Responsive Image on ionic Tab bar
        • Show table when its tab is clicked but hide other tables
        • Change TabItem's Header FontWeight
        • Can I force to keep the chrome tab open via extension?
        • Chrome.runtime.onMessage.addListener on new tab not receiving message from popup.js
        • Tabs in TabLayout not filling up entire ActionBar
        • jquery ui datepicker not working with tabs
        • ResponsiveTabs add onclick in js file

        Related Questions in JQUERY-UI-TABS

        • Having trouble focusing on the TAB that I was currently working on
        • jQuery tabs enable horizontal scroll
        • Tabs JQuery UI: not show graphic elements in inactive tab
        • Multiple jQuery UI Tabs on Page: Close all other tabs when another is opened
        • jQuery tabs: How to avoid display of tabs while loading?
        • JQUERY UI TABS - PreventDefault jumping
        • oscMax jquery nested tabs issue
        • How to make element inside table switch tabs using jquery ui tabs
        • Tabs, Hide Previous on first tab and next on last
        • How to trigger tab using jQuery
        • jquery-ui tabs getting anchor href with older jquery 1.8
        • External file does not load in jQuery Tabs
        • How to pre-load tab content (other view with table and data loaded from DB using Zend controllers), before displaying tabs ?
        • jQuery UI Tabs: Don't let user switch tabs if form input in active tab has content
        • Dynamic Jquery Tabs based on Php foreach

        Related Questions in JQUERY-TABS

        • Flask URL routing : url_for only passes first argument
        • jQuery tabs enable horizontal scroll
        • Links do not redirect to Jquery Tabs
        • Multiple jQuery UI Tabs on Page: Close all other tabs when another is opened
        • bxslider not activating in tabs ui
        • How to adjust the position of accordion so that the menu does not shift?
        • Display a processing label on a jQueryUI Tab while loading the tabs content
        • Dynamic Jquery Tabs based on Php foreach
        • jQuery Mobile Tabs not showing all content
        • How to make these Jquery tabs linkable through ahref?
        • remove background colour from jquery tabs
        • Setting jQuery UI Tab Duration/Time on a Per Tab Basis
        • jquery hide my content
        • Cannot load Jquery or JQuerry.tabify
        • JQuery idTabs - problems with hash

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?
        .

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Math
        • Aftereffectstemplates