在iframe中更改字体大小 [英] change font-size in iframe
本文介绍了在iframe中更改字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过单击iframe超链接外部来更改iframe内容的字体大小
Hi,
How can i change font-size of the iframe contents by clicking outside of iframe hyperlink
推荐答案
请注意,这不是立即可用的解决方案.它仅是概念的证明,未经IE& amp;的任何其他浏览器进行过测试.火狐.它可以工作,并且可能会给您一些思路,使它也可以在其他浏览器上工作.实际上,它不会更改字体大小,而是使用缩放样式使框架可缩放.不知道您是否可以使用它,但是我发现它很整洁.享受吧!
Please be reminded that this is not a ready to use solution. It is merely a proof of concept and has not been tested on any other browsers than IE & FireFox. It works and might give you some ideas to explore to make it work on other browsers too. It actually does not change the font-size, but rather uses the zoom style to make the frame zoomable. Not sure if you can use this, but I found it rather neat. Enjoy!
<html>
<style>
#wrap { width: 600px; height: 390px; padding: 0; overflow: hidden; }
#frame { width: 800px; height: 520px; border: 1px solid black; }
#frame { zoom: 0.75; -moz-transform: scale(0.75); -moz-transform-origin: 0 0; }
</style>
<body>
<p>Some text before the frame</p>
<div id="wrap">
<iframe id="frame" src="http://www.apache.org"></iframe>
</div>
<p>Some text after the frame</p>
<form>
<input type="button" value="Zoom out" name="btn_zoomout" onclick="zoomout();"/>
<input type="button" value="Zoom in" name="btn_zoomin" onclick="zoomin();"/>
</form>
<script type="text/javascript">
var zoom = 0.75;
function zoomout()
{
zoom = zoom - 0.1;
var element = document.getElementById("frame");
// This line does the trick for FireFox
element.style.MozTransform = "scale(" + zoom + ")";
// This line does the trick for IE
element.style.zoom = "" + zoom;
}
function zoomin()
{
zoom = zoom + 0.1;
var element = document.getElementById("frame");
// This line does the trick for FireFox
element.style.MozTransform = "scale(" + zoom + ")";
// This line does the trick for IE
element.style.zoom = "" + zoom;
}
</script>
</body>
</html>
问候,
曼弗雷德(Manfred)
Regards,
Manfred
这篇关于在iframe中更改字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文