Bootstrap tab - active class not working on page loading

前端 未结 6 636
暗喜
暗喜 2021-01-01 21:34

My code is below. Notice the tab \'one\' is active. But the problem is when i open the page, the tab really shows active, BUT the tab content does not show ; it only shows w

6条回答
  •  清歌不尽
    2021-01-01 21:52

    I had the same problem but using navpills.

    None of the other solutions worked for me. Finally I solved it using jquery:

    $(document).ready(function () 
    {
        // somehow first navpill will not look active on page load (although it is...)
        $('.navpill.active').trigger('click');
    });
    

    I guess it would work the same for navtabs, only use $('.nav.active') to locate the correct element.

提交回复
热议问题