3

When I use a youtube iframe in or out of a div using transform: translate() it doesn't allow me to play the video in Firefox. Works in all other browsers even IE8. Here is a fiddle I created http://jsfiddle.net/kE6vp/ If you comment out the transform property it works fine, but with it the youtube buttons can't be accesed. Once again only in Firefox. Anyone experience this before? I'm using jquery isotope plugin which places content using the transform property. Thanks for any help.

<div class="pong">
    <div class="ping">
        <iframe width="326" height="237" frameborder="0" allowfullscreen="1" src="https://www.youtube.com/embed/lEhu2cFvDe8?wmode=opaque?rel=0?autoplay=1&amp;"></iframe></div>
</div>

.pong{
    height: 237px;
    transform: translate(20px, 100px);
    width: 326px;
}

.ping{
    height: 237px;      
    position: absolute;
    width: 326px;       

    z-index: 40000;
}

1 Answer 1

5

It seems this is a problem with Flash on Firefox, if you force YouTube's HTML5 player then the problem is fixed.

http://jsfiddle.net/8EMzc/

You do this by appending &html5=1 to YouTube's embed URL. I suppose that if HTML5 is not supported it will fall back to Flash, but I'm not sure about this. You could also browser sniff and serve the HTML5 player to Firefox only (not recommended, but you're working around a bug, so there's no straightforward way to address this).

Alternatively, you can disable CSS transforms in Isotope with the transformsEnabled option

$('#container').isotope({
  transformsEnabled : false
});
7
  • Thanks Duopixel. Not the answer I was hoping to unfortunately. :-( I working on a project using jquery.isotope to lay things out. It uses the transform: translate() for the layout. Might you have a suggestion on another plugin that might do the trick for me that doesn't use this approach? Thanks again for the help.
    – ski760
    Jul 19, 2013 at 16:19
  • I don't see why this solution is not a good option (all you have to do is to use the HTML5 player). However, you can tell Isotope not to use CSS transforms with the transformsEnabled: false option (anwer updated). Jul 19, 2013 at 18:01
  • Duopixel! I greatly appreciate all the help.
    – ski760
    Jul 22, 2013 at 13:56
  • Excellent! This also solved my issue with displaying a YouTube video in a Bootstrap modal dialog box, which also uses a CSS transform.
    – DaveGauer
    Oct 29, 2013 at 18:54
  • I found the html5 seemed to fix my problem. I am still curious what the Isotope transforms is and why it works, mind explaining? (I read your page but didn't see the reasoning) Dec 27, 2013 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.