当iframe被调整大小时,如何防止swf刷新?

时间:2022-12-22 20:36:04

I am resizing an iframe, and when I do that in Firefox, the content gets refreshed.

我正在调整一个iframe,当我在Firefox中这样做时,内容会被刷新。

I have a swf that extends, and in Firefox when the iframe extends to accommodate the swf, the swf appears in its normal position.

我有一个扩展的swf,在Firefox中,当iframe扩展以适应swf时,swf会显示在正常的位置。

In IE this doesn't happen.

在IE中不会发生这种事。

Anyone know how to prevent the refresh from happening in Firefox?

有人知道如何防止Firefox中出现刷新吗?

Thanks

谢谢


Edit:

编辑:

Ok I think the page is not being refreshed just the swf please check this out at:

好的,我认为页面没有刷新,只是swf请查看:

http://antoniocs.org/iframe/index_.html

http://antoniocs.org/iframe/index_.html

You can see that when the re-dimensioning takes place there is a quick "flash", in Firefox 3 and the swf returns to its initial state (not expanded), this does not happen in IE.

您可以看到,当重新维度发生时,会有一个快速的“flash”,在Firefox 3中,swf返回到初始状态(未展开),这在IE中不会发生。

The code is all client side so you can view it all if you look at the source of the pages.

代码都是客户端,所以如果查看页面的源代码,可以查看所有的代码。

4 个解决方案

#1


4  

Antonio, I'm afraid that the problem is in Firefox it self. When Gecko detects a change to the width of an iFrame, it repaints the page and causes that "refresh." There's no way that I know of to change this behavior, short of using a different technique.

安东尼奥,恐怕问题出在火狐本身。当Gecko检测到iFrame宽度的变化时,它会重新绘制页面并导致“刷新”。除了使用不同的技术,我不知道有什么方法可以改变这种行为。

I confirmed that the problem exists in other Gecko-based browsers as well (specifically Camino and Flock). I was not able to duplicate it in WebKit-based browsers (Chrome and Safari).

我确认了这个问题也存在于其他基于geck的浏览器中(特别是Camino和Flock)。我无法在基于webkit的浏览器(Chrome和Safari)中复制它。

#2


3  

It seems to be that either setting position: absolute; or .cssText will refresh the frame.

这两种设定都是绝对的;或者。csstext刷新框架。

The solution is to add style="position: absolute;" to your <iframe> and set your css like this:

解决方案是将style="position: absolute;"添加到

this.mrec_div_idObj.style.left = ((offsetLeftIframe) - (dimX - disX)) + "px";
this.mrec_div_idObj.style.top = (offsetTopDiv - disY) + "px";
this.mrec_div_idObj.style.zIndex = 99999999;
this.mrec_div_idObj.style.margin = 0;
this.mrec_div_idObj.style.padding = 0;

I've tested this and it works in Firefox 3.

我已经在firefox3中测试过了。

#3


0  

There is no onresize code.

没有onresize代码。

It's simple! I have an iframe with width 300 and height 250 and when I change them to 500 and 400 firefox refreshes the content and I want to prevent that.

很简单!我有一个宽度为300和高度为250的iframe,当我将它们更改为500和400时,firefox会刷新内容,我想防止这种情况发生。

#4


0  

Here is a page where you can see the code -> http://antoniocs.org/iframe/index_.html

这是一个您可以看到代码的页面——> http://antoniocs.org/iframe/index_.html

The code to re size the iframe runs after 3 seconds and you can see the the swf, if it was extended, appears in it's initial (not extended) form.

重新调整iframe大小的代码在3秒后运行,您可以看到swf,如果它被扩展了,就会以它的初始(非扩展)形式出现。

To extend the swf just hover the mouse over it.

要扩展swf,只需将鼠标悬停在它上面。

In ie there is no refresh in the iframe.

在ie中,iframe中没有刷新。

#1


4  

Antonio, I'm afraid that the problem is in Firefox it self. When Gecko detects a change to the width of an iFrame, it repaints the page and causes that "refresh." There's no way that I know of to change this behavior, short of using a different technique.

安东尼奥,恐怕问题出在火狐本身。当Gecko检测到iFrame宽度的变化时,它会重新绘制页面并导致“刷新”。除了使用不同的技术,我不知道有什么方法可以改变这种行为。

I confirmed that the problem exists in other Gecko-based browsers as well (specifically Camino and Flock). I was not able to duplicate it in WebKit-based browsers (Chrome and Safari).

我确认了这个问题也存在于其他基于geck的浏览器中(特别是Camino和Flock)。我无法在基于webkit的浏览器(Chrome和Safari)中复制它。

#2


3  

It seems to be that either setting position: absolute; or .cssText will refresh the frame.

这两种设定都是绝对的;或者。csstext刷新框架。

The solution is to add style="position: absolute;" to your <iframe> and set your css like this:

解决方案是将style="position: absolute;"添加到

this.mrec_div_idObj.style.left = ((offsetLeftIframe) - (dimX - disX)) + "px";
this.mrec_div_idObj.style.top = (offsetTopDiv - disY) + "px";
this.mrec_div_idObj.style.zIndex = 99999999;
this.mrec_div_idObj.style.margin = 0;
this.mrec_div_idObj.style.padding = 0;

I've tested this and it works in Firefox 3.

我已经在firefox3中测试过了。

#3


0  

There is no onresize code.

没有onresize代码。

It's simple! I have an iframe with width 300 and height 250 and when I change them to 500 and 400 firefox refreshes the content and I want to prevent that.

很简单!我有一个宽度为300和高度为250的iframe,当我将它们更改为500和400时,firefox会刷新内容,我想防止这种情况发生。

#4


0  

Here is a page where you can see the code -> http://antoniocs.org/iframe/index_.html

这是一个您可以看到代码的页面——> http://antoniocs.org/iframe/index_.html

The code to re size the iframe runs after 3 seconds and you can see the the swf, if it was extended, appears in it's initial (not extended) form.

重新调整iframe大小的代码在3秒后运行,您可以看到swf,如果它被扩展了,就会以它的初始(非扩展)形式出现。

To extend the swf just hover the mouse over it.

要扩展swf,只需将鼠标悬停在它上面。

In ie there is no refresh in the iframe.

在ie中,iframe中没有刷新。