How to add wmode=“transparent” for every flash object & ebmed tag?

后端 未结 6 720
無奈伤痛
無奈伤痛 2020-12-14 04:29

I have a page which displays dynamic flash content from issuu.com. I need to add wmode=\"transparent\" because otherwise navigation menu shows under flash. Is t

6条回答
  •  轮回少年
    2020-12-14 05:11

    This is the most simple and browser-compatible solution I could find in order to remove wMode="window" objects AFTER the page has already been rendered.

    In Internet Explorer, an object's child nodes cannot be modified once it has been inserted into the DOM. The best solution is to re-insert/re-render it by modifying outerHTML.

    In most other browsers, modifying an object/embed's attributes is possible but has no effect once it has been rendered. Here, a re-insertion of the element at the same position causes a re-rendering. .wrap().unwrap() is the most simple way for this that comes up to my mind in jQuery.

    $("embed[wmode=window], embed:not([wmode])").attr("wmode", "opaque").wrap("
    ").unwrap(); $("object:has(param[name=wmode][value=window]), object:not(:has(> param[name=wmode]))").each(object); function object() { this.outerHTML = this.outerHTML.replace(/<(?:[^">]+|(["']).*?\1)*>/, '$&'); }

提交回复
热议问题