Victor Bjelkholm
Victor Bjelkholm

Reputation: 2016

Playback of Youtube stops when hiding element in Firefox

I'm trying to enable hiding a Youtube-video, while it plays. In Chrome, it works great but in Firefox, the playback stops when hiding.

This is my code for clicking on the #hide

$('#hide').click(function(){
            $('.flash-wrapper').toggleClass("hidden");
            $('#footer').fadeToggle();
            var hideText = $('#hide').text();
            if(hideText == "Hide everything") {
                $('#hide').text('Show everything');
            } else {
                $('#hide').text('Hide everything');
            }
        });

hidden class

.hidden {
        position: absolute;
        left: -10000px;

    }

Example of one .flash-wrapper

<div class="flash-wrapper Jj6yXxVc21Y">
<div id="Jj6yXxVc21Y">
  You need Flash player 8+ and JavaScript enabled to view this video.
</div>
    <script type="text/javascript">

        var params = { allowScriptAccess: "always" };
        var atts = { id: "Jj6yXxVc21Y" };
        swfobject.embedSWF("http://www.youtube.com/v/Jj6yXxVc21Y&enablejsapi=1&playerapiid=ytplayer", "Jj6yXxVc21Y", "250", "25", "8", null, null, params, atts);

    </script>
</div>

flash-wrapper class

.flash-wrapper {
    float: left;
    margin-left: 5px;
}

Upvotes: 0

Views: 222

Answers (1)

Victor Bjelkholm
Victor Bjelkholm

Reputation: 2016

I changed .hidden to the following code and now the playback doesn't stop

.hidden {
    margin-top: -1000px;
}

Upvotes: 1

Related Questions