开发者

Dynamically set iframe scrollable

开发者 https://www.devze.com 2023-01-17 22:20 出处:网络
I have to make an iframe element from java script so it isn\'t scrollable anymore(the javascript function is called from a iframe inside the one that I have to change).Now it works but only on Firefox

I have to make an iframe element from java script so it isn't scrollable anymore(the javascript function is called from a iframe inside the one that I have to change).Now it works but only on Firefox and Chrome and I must do it on IE also.

I have no alternative than to change the scroll bars to the parent iframe and to understand why, I have jquery tabs in the application and each tab loads on the same iframe. Problem came when I faced sub tabs...in this case, I need only the sub iframe to be scrollable.

In Firefox and Chrome I simply set overflow="hidden" and scrolling="no" to the parent iframe and works.

It is possible to dynamically set a iframe to 开发者_StackOverflow社区have scrollbars or not through javascript in IE? Thanks, Luisa


With IE you need to set the html frame being displayed via iframe as "display:hidden" on the body If you don't have access to the iframe (say it's from another site) then there's not much you can do as all the content is independent.

(If that doesn't work you can try putting an iframe in side an iframe and make the 2nd level down (page being viewed though your initial site) to show the 2nd iframe's dimensions(3rd level down) big enough so the initial view cuts off the scroll bars.

Though this is bad coding, I don't recommend it.)

Can you give more details as I'm not sure if you have access to the Iframe or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消