'Bootstrap tabs (shown.bs.tab) [duplicate]

I am trying to make a tab section in which tab content part we have videos, but when we click on any other tab while the video is playing and then it plays in the background,

so I want to pause the video when I click on any tab of the tab.

If anyone has any solution can you share it with me?



Solution 1:[1]

Generally you'll need to handle the hide.bs.tab event which is fired before the tab is changed and then pause the video. Note that the selector below 'a[data-toggle="tab"] needs to be specific to the tab that plays the video.

$('a[data-toggle="tab"]').on('hide.bs.tab', function (e) {
  // Pause video
})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rich Wagenknecht