Wednesday, March 20, 2013

Youtube Video Overlay issue with web page

As part of our new website redesign,there was a issue with youtube video overlay with existing content on webpage so found this article which resolves the issue by adding parametre which indicates video to be transparent mode.

http://maxmorgandesign.com/fix_youtube_iframe_overlay_and_z_index_issues/



   $(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);
    });
});

No comments:

Post a Comment