iframemenubugs

YouTube iFrame Videos Overlay Menu Dropdowns, Z-Index Problem

Posted on by John MacMenamin

It’s an epic problem. Youtube videos overlaying my menu drop downs. It drives me crazy!
Vimeo videos seem to be much more professional in their code generation. I didn’t seem to need any code for them.

Well after a week of invaded spartan level of frustration  I found a lovely jQuery code that automates modifying iframe youtube videos embed codes. YeAAAhh braaa finely enjoy!

 

$(document).ready(function() {
$("iframe").each(function(){
var ifr_source = $(this).attr('src');
var wmode = "wmode=transparent";
if(ifr_source.indexOf('?') != -1) {
var getQString = ifr_source.split('?');
var oldString = getQString[1];
var newString = getQString[0];
$(this).attr('src',newString+'?'+wmode+'&'+oldString);
}
else $(this).attr('src',ifr_source+'?'+wmode);
});
});



About John MacMenamin

John MacMenamin is the driving force behind alteredadvice.com a WP Development Magazine. If you'd like to keep in touch you can follow Altered on twitter or become a friend on facebook.
View all posts by John MacMenamin → This entry was posted in General, jQuery. Bookmark the permalink.


  • DDB2W

    Amazing! Thanks :D

  • Rohit suri

    Thanks buddy , you rock.. saved my time………….

  • Anis 101

    hello, thank you saved my life, the code works :-)




SEO Powered By SEOPressor