我有一个 Flash 媒体播放器,我希望它漂浮在我们论坛的顶部,这样当用户向下滚动时,媒体播放器就会跟随。
我还没有找到一种方法让它位于 html 之上。它总是把它压低。
你可以在http://www.gcehosting.com/stackoverflow看到我说的媒体播放器
这是代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Music Player Widget - Preview 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: #000000;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>
</head>
<body>
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100%" height="100%" id="main" align="middle">
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="transparent" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="main.swf" width="100%" height="100%">
<param name="movie" value="main.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="transparent" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
我希望有人能够提供解决方案
最佳答案
您可以将wmode
参数设置为transparent
,这会使您的SWF 的所有非对象区域都透明。然后使用绝对 CSS 定位将其置于网页中任何位置的顶部。
来自this tutorial的相关代码片段:
#wrapper {
position: absolute;
top: 0;
left: 0;
width: 900;
height: 900;
z-index: 1;
}
<div id="wrapper">
<object>
<param name="movie" value="dummy.swf">
<param name="wmode" value="transparent">
<embed src="dummy.swf" wmode="transparent">
</object>
</div>
关于html - 如何让flash悬浮在网站上方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9524010/