如何使iframe适合屏幕 [英] How to make iframe fit to the screen
本文介绍了如何使iframe适合屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个aspx页面,我有一个iframe用于显示另一个页面,所以我想让iframe适合窗口的高度和宽度。我尝试了所有,我找不到合适的解决方案,所以任何人都可以帮助我..
提前谢谢
Hi
I have an aspx page and in that i have an iframe for displaying another page, so i want to make that iframe to fit to the window height and width. i tried all and i couldn't find the appropraite solution so can anyone please help me..
Thanks in advance
推荐答案
Karthik,
你需要使用RESPONSIVE iFrame。希望这会帮助你解决。请阅读
您好,>
请参阅以下链接,它可能对您有所帮助...
http://davidjbradshaw.github.io/iframe-resizer/ [ ^ ]
即使iframe内容动态更改,它也会自动调整iframe的大小。
谢谢,
Magesh M
Hi,
Refer the Following link and it may helpful to you ...
http://davidjbradshaw.github.io/iframe-resizer/[^]
It automatically re size the iframe even the iframe contents changed dynamically..
Thanks,
Magesh M
Hi Karthik,
After googling I got this solution and it is working fine for every browser.
..
..
<blockquote class="quote"><div class="op">Quote:</div><![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>]]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
/** This is high-level function.
* It must react to delta being more/less than zero.
*/
function handle(delta) {
var d=delta*-10;
window.scrollBy(0,d);
}
/** Event handler for mouse wheel event.
*/
function wheel(event){
var delta = 0;
if (!event) /* For IE. */
event = window.event;
if (event.wheelDelta) { /* IE/Opera. */
delta = event.wheelDelta/120;
/** In Opera 9, delta differs in sign as compared to IE.
*/
if (window.opera)
delta = -delta;
} else if (event.detail) { /** Mozilla case. */
/** In Mozilla, sign of delta is different than in IE.
* Also, delta is multiple of 3.
*/
delta = -event.detail/3;
}
/** If delta is nonzero, handle it.
* Basically, delta is now positive if wheel was scrolled up,
* and negative, if wheel was scrolled down.
*/
if (delta)
handle(delta);
/** Prevent default actions caused by mouse wheel.
* That might be ugly, but we handle scrolls somehow
* anyway, so don't bother here..
*/
if (event.preventDefault)
event.preventDefault();
event.returnValue = false;
}
/** Initialization code.
* If you use your own event management code, change it as required.
*/
if (window.addEventListener)
/** DOMMouseScroll is for mozilla. */
window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<iframe width="300" height="300" scrolling="no" frameborder="1" src="http://www.w3schools.com"></iframe>
</div>
</form>
</body>
</html></blockquote>
这篇关于如何使iframe适合屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文