【发布时间】:2016-06-27 21:39:20
【问题描述】:
我正在制作一个 Flash 画廊,对于这个画廊,我希望视频具有一定的大小。当我第一次开始研究它时,闪光灯只会非常小,并且不会正确调整自身的大小。昨晚深夜,我让它工作到正确的大小,但无论出于何种原因,它似乎占据了整个 body 标记并将所有其他元素推入 html 元素。作为一个例子,我放了一个 h1 标签来展示它是如何做到这一点的。我正在使用 swffit 和 swfobject 让闪存正常工作,但我几乎可以肯定问题出在 swffit 甚至我的代码上。我开始为此制作一个 jsfiddle 示例,但它对我尝试放入的任何 flash 对象都非常繁琐。对此的任何帮助将不胜感激。
SWFOBJECT:https://github.com/swfobject/swfobject.git
SWFFIT:http://swffit.millermedeiros.com/
HTML 和 JAVASCRIPT
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Flash Test</title>
<meta name="description" content="Flash stuff">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="styles/style.css">
<script src="js/swfobject.js"></script>
<script src="js/swffit.js"></script>
<script type="text/javascript">
var height = window.innerHeight - 160;
var width = window.innerWidth - 140;
if ((height * 1.375) < width) {
width = height * 1.375;
} else {
height = width / 1.375;
}
</script>
<script type="text/javascript">
var flashvars = {},
//params = {wmode:"transparent"},
params = {},
attributes = {};
swfobject.embedSWF("swfs/scoob.swf", "moviefun", width -140, height -160, "9.0.0", "js/swfobject.js", flashvars, params, attributes);
swffit.fit("moviefun", "1", "1", width, height, true, false);
</script>
</head>
<body>
<script type="text/javascript">
window.onresize = doResize;
function doResize() {
height = window.innerHeight - 160;
width = window.innerWidth - 140;
if ((height * 0.7175) < width) {
width = height * 0.7175;
} else {
height = width / 0.7175;
};
swffit.fit("moviefun", "1", "1", width, height, true, false)
}
</script>
<div>
<h1 id="mainText">Hey there</h1>
<div id="moviefun">It didn't work prob bc of internet explorer... if not though can't help ya......</div>
</div>
<script src="scripts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>
</html>
CSS
body {
background-color: red;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-size: 10px;
}
#moviefun {
position: absolute;
top: 0px;
left: 70px;
background-color: red;
}
#mainText {
background: yellow;
}
这是一个问题的图像,它比它想象的要小,并且仍在将所有其他内容推入 HTML 标记
【问题讨论】:
标签: javascript html css flash swfobject