FF3/Windows CSS z-index 문제 YouTube 플레이어
문제
내가 붙어에서 나타나는 것이 CSS/z-index 과 충돌하 YouTube 플레이어입니다.Firefox 에서 3 윈도우 XP 에서 살펴보고,이 페이지: http://spokenword.org/program/21396 클릭 수집 버튼을 주는 팝업 <div> 나 아 YouTube 플레이어입니다.에 다른 브라우저 <div> 상단에 나타납니다.그것에는 z-index 값의 999999.나는 설정을 시도했는 z-index 의 <object> 요소를 포함하는 플레이어 낮은 값을 가지고 있지만,작동하지 않았다.어떤 아이디어를 얻는 방법을 표시하는 팝업을 통해 플레이어입니까?
해결책
추가하십시오 wmode
매개 변수 opaque
이와 같이:
(포함되어 있습니다 둘 다 ㅏ <param>
꼬리표 그리고 ㅏ wmode
속성 <embed>
꼬리표.)
<object width='425' height='344'>
<param name='movie' value='http://www.youtube.com/v/Wj_JNwNbETA&hl=en&fs=1'>
<param name='type' value='application/x-shockwave-flash'>
<param name='allowfullscreen' value='true'>
<param name='allowscriptaccess' value='always'>
<param name="wmode" value="opaque" />
<embed width='425' height='344'
src='http://www.youtube.com/v/Wj_JNwNbETA&hl=en&fs=1'
type='application/x-shockwave-flash'
allowfullscreen='true'
allowscriptaccess='always'
wmode="opaque"
></embed>
</object>
다른 팁
추천하지만 CMS 에 의해 유효한,중요한 업데이트합니다.를 사용하려면'iframe'대신에'을 포함',단순히 추가 ?wmode=transparent
동영상 링크는 않습니다.이 더 간단하고 깨끗합니다.
업데이트, Feb2014
안이 될 수 있다는 오래되었습니다.
누군가를 보고는 지금 &wmode=transparent
작동 대신 합니다.
모든 브라우저에서 고정하는 순수한 JS 기능을 찾았습니다!
당신은 간다 :
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(/<embed\s/i, "<embed wmode='transparent' ");
// replace the old embed object with the fixed version
embed.insertAdjacentHTML('beforeBegin', new_embed);
embed.parentNode.removeChild(embed);
} else {
// cloneNode is buggy in some versions of Safari & Opera, but works fine in FF
new_embed = embed.cloneNode(true);
if (!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase() == 'window')
new_embed.setAttribute('wmode', 'transparent');
embed.parentNode.replaceChild(new_embed, embed);
}
}
// loop through every object tag on the site
var objects = document.getElementsByTagName('object');
for (i = 0; i < objects.length; i++) {
object = objects[i];
var new_object;
// object is an IE specific tag so we can use outerHTML here
if (object.outerHTML) {
var html = object.outerHTML;
// replace an existing wmode parameter
if (html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i))
new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i, "<param name='wmode' value='transparent' />");
// add a new wmode parameter
else
new_object = html.replace(/<\/object\>/i, "<param name='wmode' value='transparent' />\n</object>");
// 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(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i, "<param name='flashvars' value='" + children[j].getAttribute('value') + "' />");
}
}
}
catch (err) {
}
}
// replace the old embed object with the fixed versiony
object.insertAdjacentHTML('beforeBegin', new_object);
object.parentNode.removeChild(object);
}
}
}
이제 페이지에 jQuery가로드되면 실행할 수 있습니다.
$(document).ready(function () {
fix_flash();
});
우리는 사용 jQuery 플래시 플러그인 YouTube 링크를 플래시 영화로 변환합니다. 이 경우 WMODE는 YouTube 비디오를 jQuery 대화 상자 아래에 나타나도록 옵션으로 전달됩니다.
$('a[href^="http://www.youtube.com"]').flash(
{ width: nnn, height: nnn, wmode: 'opaque' }
);
것으로 나타났 wmode="불투명"정말 영향을 미치에 사용법 수 있습니다.크롬 확인에 나 노트북 50%CPU 사용량(지 않고 불투명한~8%).
그래서 조심으로 이 옵션을 선택합니다.