• Resolved Philipp

    (@phlei)


    Hi Miles,

    I’m a big fan of your plugin, it’s really excellent.

    I’m a bit desperate with the “Tabs” block, though. I can’t get the tab content of the inactive tab to be hidden, as you would expect with tab navigation.

    According to the description on the block, this should work: “Create tabbed content that will show / hide based on the relevant tab being clicked.”

    I also think that the markup of the automatically created “Div” blocks is not complete.

    I found this old post, but unfortunately it didn’t really help either, especially since the video no longer exists: https://ww.wp.xz.cn/support/topic/nav-tabs-activating-containers/

    Am I missing something and if so, what?

    Best wishes
    Philipp

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author all_bootstrap_blocks

    (@areoimiles)

    Hi @phlei

    Thanks for reaching out!

    Can I check, are you including the Bootstrap JS that comes bundled in with the plugin? The option is set in Bootstrap > Dashboard > Include Bootstrap JS.

    The hiding of tab content is done via JS so if this isn’t checked then the tab content will not be hidden. You have two options, you can check this option so the JS is automatically included, or you can add some custom JS to manage the tab functionality.

    Below is the code that gets included so you can add this into your own JS file if needed and include it on the page.

    jQuery(document).ready(function($){

    $( '.areoi-tabs' ).each( function() {

    var active = $( this ).find( '.nav a.active:first-of-type' );

    $( this ).find( '.nav a.active:not(:first-of-type)' ).removeClass( 'active' );

    $( this ).find( '> div' ).addClass( 'tab-pane d-none' );

    var active_tab = $( this ).find( active.attr( 'href' ) );

    if ( active_tab ) {
    active_tab.removeClass( 'd-none' );
    }
    });

    $( document ).on( 'click', '.areoi-tabs .nav a', function( e ) {
    var href = $(this).attr('href');
    if (href && href.startsWith('#')) {
    e.preventDefault();

    var container = $( this ).parents( '.areoi-tabs' );
    var active_tab = container.find( $( this ).attr( 'href' ) );

    container.find( '.nav a' ).removeClass( 'active' );
    $( this ).addClass( 'active' );

    if ( active_tab ) {
    container.find( '> div' ).addClass( 'd-none' );
    active_tab.removeClass( 'd-none' );
    }
    }
    } );

    });

    Hopefully, this helps you resolve your issue, but if not please could you provide a link to a staging site so that I can debug the issue?

    Thanks
    Miles

    Thread Starter Philipp

    (@phlei)

    Hi @areoimiles,

    Bull’s eye! 🙂

    I deliberately deactivated this setting because I use a theme that already includes Bootstrap 5.3.

    But the theme’s sources obviously don’t work here. I have to find out why that is. All your other blocks like accordion or slider work, so it never occurred to me that that was the problem.

    If I activate “Include Bootstrap JS” it works and I can also use your snippet in my JS and it works.

    Thank you very much for your quick and competent feedback. 🙂
    Philipp

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Block: “Tabs” doesn’t work as expected’ is closed to new replies.