Note that there are some explanatory texts on larger screens.

plurals
  1. POVideo doesn't stop when switching tabs
    primarykey
    data
    text
    <p>I have a tab interface on my website that contains images and a youtube video on the last tab. All works fine however everytime I switch tabs the video doesn't stop playing. Is there a way to fix this? Thanks in advance.</p> <p>Here's the script for the tabs:</p> <pre><code>$("#simple-tabs .tab_content").hide(); //Hide all content $("#simple-tabs ul.tabs li:first").addClass("active").show(); //Activate first tab $("#simple-tabs .tab_content:first").show(); //Show first tab content //On Click Event $("#simple-tabs ul.tabs li").click(function(e) { $("#simple-tabs ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $("#simple-tabs .tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content e.preventDefault(); }); (function ($) { $('.tab ul.tabs li:first-child a').addClass('current'); $('.tab .tab_content div.tabs_tab:first-child').show(); $('.tab ul.tabs li a').click(function (g) { var tab = $(this).parent().parent().parent(), index = $(this).parent().index(); tab.find('ul.tabs').find('a').removeClass('current'); $(this).addClass('current'); tab.find('.tab_content').find('div.tabs_tab').not('div.tabs_tab:eq(' + index + ')').slideUp(); tab.find('.tab_content').find('div.tabs_tab:eq(' + index + ')').slideDown(); g.preventDefault(); } ); } )(jQuery); </code></pre> <p>And here's the HTML markup:</p> <pre><code>&lt;div id="tab3" class="tab_content"&gt; &lt;div class="video-container"&gt; &lt;iframe width="510" height="270" src="http://www.youtube.com/embed/6Cf7IL_eZ38" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload