一聚教程网:一个值得你收藏的教程网站

热门教程

firefox下reflow导致flash重新加载

时间:2022-06-28 22:55:38 编辑:袖梨 来源:一聚教程网

过程是这样的:

我页面嵌入了flash,flash初始化完成开始执行它的任务,这时用户的一个操作:将 body的overflow设置为了hidden,这时触发了reflow,flash重新加载,正在进行的进程被打断,js开始报错。
我试着改变 flash的position:absolute;z-index,top,left等属性,未果。
我试着将flash嵌入到iframe中,但是火狐 的reflow 竟然也会导致 iframe内的flash重新加载,再次失败。
好像已经山穷水尽。
好吧终于:大找到了解决方法change_body_properties_overflow_troubles_in_firefox:将flash嵌入到body以外

 代码如下 复制代码
//创建元素
var el = document.createElement('div');
el.id = 'flashcon';
document.documentElement.appendChlid(el);
//than 嵌入 flash
swfobject.embedSWF('');

Change Body properties (overflow) : troubles in firefox.
Edit Subject When Changing Body properties (overflow) there is a trouble in firefox
document.getElementById('body').style.overflow = 'auto'; //body tag
or
document.getElementById('html').style.overflow = 'auto'; //html tag
and it is the same with overflow-x or overflow-y

the sound is stopped and soundmanager is reseted:
(Flash): Flash to JS OK

no problem in IE

 

热门栏目