Fix Iframes With Wmode

Posted by on Mar 19, 2013 in Snippet | No Comments

This will fix all issues with iframes overlapping things like lightbox or pop-up navigation.


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

Leave a Reply

You must be logged in to post a comment.