How to link to tabs with jtabs?

前端 未结 2 1468
广开言路
广开言路 2021-01-17 05:06

I added tabs to a section of my page I am working on (stridertechnologies.com/stoutwebsite/products.php)using the steps found at this website: http://code-tricks.com/create-

2条回答
  •  北海茫月
    2021-01-17 05:41

    How about something like this? Basically we are taking the value of data-toggle in our buttons, and passing it into the selector for each tab content

    JS

    $('a[data-toggle]').on('click', function () {
        var dataToggle = $(this).data('toggle');
    
        $('.tabContent > div').removeClass('active');
        $('.tabContent > div#'+dataToggle+'').addClass('active');
    });
    

    working example: http://jsfiddle.net/whiteb0x/VdeqY/

提交回复
热议问题