我有一个iframe到运行Flash swf文件的页面;有没有人知道如何使它透明,以便我的下拉菜单应该完美显示?请注意,我无法编辑源页面(将param = wmode, value = transparent
添加到Flash对象中),只有在我的页面上有任何机会使iframe或某些JavaScript成为可能时,我已经尝试{{1 }和allowtransparency="true"
。
答案 0 :(得分:1)
您可以在菜单打开时暂时隐藏包含div的闪光灯。菜单打开时使用javascript设置flashDiv.style.display = "none";
,并在菜单关闭时将其设置回flashDiv.style.display = "block"
。
答案 1 :(得分:0)
答案 2 :(得分:0)
我建议您增加下拉菜单中style.zIndex
属性的值,以便它可以显示在iframe前面,即使它不是透明的。但这只是一个想法,我不知道它是否会奏效。
要尝试此操作,因为浏览器会忽略非定位元素上的style.zIndex
属性,因此您的下拉菜单应该style.position
"relative"
或"absolute"
。< / p>
编辑:我可以看到您正在尝试在您的swfobject.js版本中添加makeWmode
函数。当然,我希望你的代码可以正常运行,但如果我可以帮助你,那么这就是我的代码......
function makeWMode(id, mode) { // id: the id of the <object> tag of the Flash object; in this case I think it is "content"
var object = swfobject.getObjectById(id);
var params = object.getElementsByTagName("param");
var success = false;
for (var i = 0; i< params.length; i++) {
if (params[i].name.toLowerCase() == "wmode") {
params[i].value = mode;
success = true;
break;
}
}
if (success == false) {
var param = document.createElement("param");
param.name = "wmode";
param.value = "transparent";
object.appendChild(param);
success = true;
return success;
}
}
使用makeWMode("content", "transparent")
向<param name="wmode" value="transparent">
标记添加了标记object
,但它可能不适用于embed
标记。
答案 3 :(得分:0)
index.html的代码如下所示:
<script type="text/javascript" src="files/swfobject.js">//</script>
<script type="text/javascript" src="files/swfaddress.js">//</script>
<script type="text/javascript" src="files/facebook.js">//</script>
<script type="text/javascript">
var assetsFolder = 'assets';
var mobileFolder = 'mobile';
var changeURL = function(){
if(document.getElementById('hrefMobile'))document.getElementById('hrefMobile').href = dir+mobileFolder+'/index.html';
if(document.getElementById('hrefSEO'))document.getElementById('hrefSEO').href = dir+assetsFolder +'/seo/toc.html';
delete changeURL;
}
if (document.addEventListener){
document.addEventListener("DOMContentLoaded", changeURL, false);
} else {
document.attachEvent("onDOMContentLoaded", changeURL);
}
function afterLoad(){
checkPage();
setFocusOnFlash();
}
function setFocusOnFlash(){
var f=swfobject.getObjectById('content');
if (f) { f.tabIndex = 0; f.focus(); }
}
function getURLParam()
{
var returnObject = {};
var href = window.location.href;
if ( href.indexOf("?") > -1 )
{
var param = href.substr(href.indexOf("?"));
var arrayParam = param.split("&");
returnObject['assets'] = assetsFolder;
for ( var i = 0; i < arrayParam.length; i++ )
{
var value = arrayParam[i].split("=");
returnObject[value[0]] = value[1];
}
}
return returnObject;
}
var dir = "./files/";
var getURI = function(){
var URIArray = document.location.href.split('/');
URIArray.length = URIArray.length-1;
var URIstr = URIArray.join('/');
URIArray = null;
var URIarr = dir.split('/');
URIarr[0] = URIarr[0]=='.'?'':URIarr[0];
var dirStr = URIarr.join('/');
URIstr = URIstr+dirStr;
return URIstr;
}
var swfName = "flippingbook.swf?rnd=44c3b8c18caec0e3862101a6d4de273f";
var ua = navigator.userAgent.toLowerCase(),
platform = navigator.platform.toLowerCase(),
UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
mode = UA[1] == 'ie' && document.documentMode;
var Browser = {
extend: Function.prototype.extend,
name: (UA[1] == 'version') ? UA[3] : UA[1],
version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
Platform: {
name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android|bada|symbian|palm|blackberry)/) || platform.match(/mac|win|linux/) || ['other'])[0]
},
Features: {
xpath: !!(document.evaluate),
air: !!(window.runtime),
query: !!(document.querySelector),
json: !!(window.JSON)
},
Plugins: {}
};
if(Browser.Platform.name == 'android' || Browser.Platform.name == 'ios') window.location = dir+mobileFolder+"/index.html";
if(Browser.Platform.name == 'webos' || Browser.Platform.name == 'bada' || Browser.Platform.name == 'symbian' || Browser.Platform.name == 'palm' || Browser.Platform.name == 'blackberry') window.location = dir+assetsFolder+"/seo/page1.html";
var flashvars = getURLParam();
var params = {baseURI: getURI(), base: dir, allowFullScreen: true, allowScriptAccess: "sameDomain", quality: "high", scale: "noscale",bg:"transparent" };
var attributes = {align: "middle" };
swfobject.embedSWF(dir + swfName, "content", "100%", "100%", "10.0.0", dir + "expressInstall.swf", flashvars, params, attributes);
</script>