Solving Z-index Problem on YouTube Iframe Video using jQuery
jQuery | January 7th, 2012A must-have feature on a WordPress theme is a dropdown menu, and it’s quite easy to make. But the problem arises when we put a YouTube iframe video just below the drop down menu, YouTube video overlaying the dropdown menu. It’s a z-index problem and we’ll solve it using simple jQuery code.

jQuery Code to Solve Z-index Problem on YouTube Iframe Video
$(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);
});
});
This jQuery code will automatically modify the iframe youtube videos embed codes. I hope this short jQuery tutorial can be useful.
Incoming search terms:
problem z youtube, youtube iframe z-index, iframe z-index issue, iframe z-index, iframe z index problem, youtube video z-index problem, transparent glass button psd, jquery iframe z-index, z index di google crom, youtube embed z-index, z-index and youtube iframe ie, youtube mp3, youtube player changes 2012 z-index, youtube z-index, youtube video z-index, z index di css di google chrome, youtube z-index firefox, youtube video z-index problem jquery, probleme youtube iframe z-index, desain batik abstrak
3 Comments
Leave a Reply




ie?
It doesn’t solve the problem in Google chrome or Internet Explorer! Only in Firefox
I’ve tested this code on Chrome and IE and I didn’t find any problems