Bootstrap tabs disappear after clicking onto another tab

点点圈 提交于 2019-12-11 11:46:00

问题


I've tried CSS tricks to try and keep the tabs to stay appearing, but everything I click a tab - it disappears as soon as I click onto another tab.

I tried moving the JS code around and moving certain CSS attributes to the bottom of the page, beneath the tab code; nothing happens.

Could it be possible that because I have a tab on the header, that it's doing this?

the code and tabs together looks ok, no misspellings.


回答1:


     $(document).off('click.tab.data-api');
    $(document).on('click.tab.data-api', '[data-toggle="tab"]', function (e) {
        e.preventDefault();
        var tab = $($(this).attr('href'));
        var activate = !tab.hasClass('active');
        $('div.tab-content>div.tab-pane.active').removeClass('active');
        $('ul.nav.nav-tabs>li.active').removeClass('active');
        if (activate) {
            $(this).tab('show')
        }
    });



回答2:


In my case it was an incompatibility with prototype :(



来源:https://stackoverflow.com/questions/35186082/bootstrap-tabs-disappear-after-clicking-onto-another-tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!