-2

I use a tab to change between videos server but I have a problem. When I click on another tab the video in the first tab keeps playing I was tried some method & function but is not working with me and I don't know any thing about JavaScript if any one can help me I would really appreciate the help

<div class="mtabs_wrapper">
<!-- Original tabs START -->

<div id="mtabs">
    <ul>
        <li><a href="#tab1" rel="tab1">Openload</a></li>
        <li><a href="#tab2" rel="tab2">Streamango</a></li>
        <li><a href="#tab3" rel="tab3">Ok.Ru</a></li>
        <li class="active"><a href="#tab4" rel="tab4">Upvid</a></li>
    </ul>
</div>

<div id="mtabs_content_container">
    <div id="tab1" class="mtab_content">
      <p><a id="simulate" href="#mtabs_wrapper#mtabs_content_container#tab2">
              <iframe class="resp-container" src="https://oload.club/embed/CAr3JJIPf8Y/"   height="485"  style="width:100%; name="search_iframe" frameborder="0" allowfullscreen="allowfullscreen" sandbox="allow-forms allow-pointer-lock allow-same-origin allow-scripts allow-top-navigation" ></iframe>  

    </div>
    <div id="tab2" class="mtab_content">
    <iframe class="resp-container" src="https://oload.club/embed/CAr3JJIPf8Y/"  height="485"  style="width:100%; name="search_iframe" frameborder="0" allowfullscreen="allowfullscreen"></iframe>  
    </div>
    <div id="tab3" class="mtab_content">
    <iframe class="resp-container" src="https://oload.club/embed/CAr3JJIPf8Y/"  height="485"  style="width:100%; name="search_iframe" frameborder="0" allowfullscreen="allowfullscreen"></iframe>  
    </div>
<div id="tab4" class="mtab_content" style="display: block;">

    <iframe class="resp-container" src="https://oload.club/embed/CAr3JJIPf8Y/"  height="485"  style="width:100%; name="search_iframe" frameborder="0" allowfullscreen="allowfullscreen"></iframe>  

</div>
<!-- Original tabs END -->

1 Answers1

0

Try this. I've used windows event

 $(window).focus(function() {
        $('#video_id').play();
    });

    $(window).blur(function() {
        $('#video_id').pause();
    });

Update

Quoted from here

Firefox will only obey requests to raise a window if a security option is set, and it's not set by default. Chrome won't pay attention to focus() requests at all, as far as I can tell. Safari does obey focus() request.

The specific Firefox setting is in the "Tools" -> "Options" ("Edit -> Preferences" on Linux, maybe MacOS) dialog. There's a "Content" tab, and in that there's a checkbox for enabling Javascript. Along with that is an "Advanced" button that brings up another dialog, wherein one finds a checkbox to allow (or disallow) the raising and lowering of windows by page code.

p u
  • 1,395
  • 1
  • 17
  • 30