FF3/Windows CSS z-index problem with YouTube player

前端 未结 5 2282
闹比i
闹比i 2020-12-07 11:45

I\'m stuck on what appears to be a CSS/z-index conflict with the YouTube player. In Firefox 3 under Windows XP, Take a look at this page: http://spokenword.org/program/21396

5条回答
  •  粉色の甜心
    2020-12-07 11:48

    i've found a pure JS function that fix it in all browsers!

    there you go:

    function fix_flash() {
        // loop through every embed tag on the site
        var embeds = document.getElementsByTagName('embed');
        for (i = 0; i < embeds.length; i++) {
            embed = embeds[i];
            var new_embed;
            // everything but Firefox & Konqueror
            if (embed.outerHTML) {
                var html = embed.outerHTML;
                // replace an existing wmode parameter
                if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i))
                    new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'");
                // add a new wmode parameter
                else
                    new_embed = html.replace(//i))
                    new_object = html.replace(//i, "");
                // add a new wmode parameter
                else
                    new_object = html.replace(/<\/object\>/i, "\n");
                // loop through each of the param tags
                var children = object.childNodes;
                for (j = 0; j < children.length; j++) {
                    try {
                        if (children[j] != null) {
                            var theName = children[j].getAttribute('name');
                            if (theName != null && theName.match(/flashvars/i)) {
                                new_object = new_object.replace(//i, "");
                            }
                        }
                    }
                    catch (err) {
                    }
                }
                // replace the old embed object with the fixed versiony
                object.insertAdjacentHTML('beforeBegin', new_object);
                object.parentNode.removeChild(object);
            }
        }
    }
    

    now you can just run in when the page loads with jQuery:

     $(document).ready(function () {
                fix_flash();    
     });
    

提交回复
热议问题