使用iframe本身缩放iframe内容
Zooming of iframe contents with iframe itself?
我有这个代码缩放iframe
function SetZoom(){
var ZoomValue = 100;
try{
iframeDoc.body.style.zoom=ZoomValue+'%';
}catch(err){}
try{
iframe.body.style.OTransform = 'scale('+(ZoomValue/100)+')';
}catch(err){}
}
现在我需要模拟iframe的缩放比如
iframe.style.width=(??????/ZoomValue)+'px';
iframe.style.height=(??????/ZoomValue)+'px';
不知道应该用什么代替???????
** edit **这应该帮助你更好,只是调用initZoom()
后iframe已添加到DOM。
var origWidth, origHeight;
// Call this once on page load
function initZoom(){
// If you know the iframe's size is in pixels
origWidth = parseFloat(iframe.style.width);
origHeight = parseFloat(iframe.style.width);
}
// Call every time you change the zoom level
function zoom(size){
iframe.style.width = (origWidth * size) + 'px';
iframe.style.height = (origHeight * size) + 'px';
}
感谢Basic
的建议。
相关文章:
- 获取iframe内容的宽度-高度
- 使用Javascript(或jQuery)加载iframe内容
- 动态(重新)创建iframe内容不会重置Chrome中的JS对象
- 将 iframe 内容传输到新的空 iframe
- 如何运行在加载时操作 iframe 内容的代码
- 如何根据 iframe 的大小调整 iframe 内容的大小
- 打印iframe内容
- Internet Explorer:可以't访问IFrame内容,除非状态代码为200
- 如何创建iframe内容的书签
- 从父窗口上的iFrame内容中关闭iFrame
- iFrame内容在盲效后丢失
- 如何在angular js中使用滚动条打印iframe内容
- iframe内容可编辑,位于jqueryUI可排序列表项中
- 当Iframe内容从按钮更改时,动态更改标头名称
- iframe内容加载后触发js函数
- 如何按时间间隔重新加载Iframe内容,使其不会闪烁
- Javascript 打印多个网页 iFrame 内容(全部打印按钮)
- 无法获取 iframe 内容
- 根据链接显示 iframe 内容
- 单击按钮时重新加载 iframe 内容(本地 HTML)