Twitter bootstrap tabs and javascript events

后端 未结 7 1517
悲哀的现实
悲哀的现实 2021-01-30 05:15

I am using twitter bootstrap for a project - in particular its tab functions (http://twitter.github.com/bootstrap/javascript.html#tabs)

Now I have this tablist and when

7条回答
  •  一向
    一向 (楼主)
    2021-01-30 05:40

    If you are using 2.3.2 and it's not working, try using:

    $(document).on("shown", 'a[data-toggle="tab"]', function (e) {
         console.log('showing tab ' + e.target); // Active Tab
         console.log('showing tab ' + e.relatedTarget); // Previous Tab
    });
    

    2.3.2 tabs usage: http://getbootstrap.com/2.3.2/javascript.html#tabs

    If you are playing with version 3 (currently RC2) then documentation shows

    $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
         console.log('showing tab ' + e.target); // Active Tab
         console.log('showing tab ' + e.relatedTarget); // Previous Tab
     })
    

    RC2 Tabs Usage: http://getbootstrap.com/javascript/#tabs-usage

提交回复
热议问题