使用iframe框架 截取外部部分页面嵌套(可以排除浏览器比例缩放影响)
来源:互联网 发布:美工刀片可以过安检吗 编辑:程序博客网 时间:2024/04/29 08:42
html页面代码
<div id="vehicleMonitoring" style="overflow:hidden;position:relative;width:100%;height:100%;">
<iframe id="myframe" frameborder="0" style="position:relative;"></iframe>
</div>
js控制代码
//车辆监控页面初始化
app.controller("vehicleMonitoring", function ($scope) {
var url = "http://blog.csdn.net/shaobingj126/article/details/23676759/";
//var url = "http://10.83.3.146:8080/jsofgisui/index.html";
var index = detectZoom();
var width = index * 1+"%";
var height = index * 1.1+"%";
var top = index * (-0.1)+"%";
$("#myframe").attr("src",url);
$("#myframe").css("width","100%");
$("#myframe").css("height",height);
$("#myframe").css("top",top);
})
app.controller("vehicleMonitoring", function ($scope) {
var url = "http://blog.csdn.net/shaobingj126/article/details/23676759/";
//var url = "http://10.83.3.146:8080/jsofgisui/index.html";
var index = detectZoom();
var width = index * 1+"%";
var height = index * 1.1+"%";
var top = index * (-0.1)+"%";
$("#myframe").attr("src",url);
$("#myframe").css("width","100%");
$("#myframe").css("height",height);
$("#myframe").css("top",top);
})
//浏览器比例缩放触发事件
$(window).resize(function() {
var url = "http://blog.csdn.net/shaobingj126/article/details/23676759/";
var index = detectZoom();
var width = index * 1+"%";
var height = index * 1.1+"%";
var top = index * (-0.1)+"%";
$("#myframe").attr("src",url);
$("#myframe").css("width","100%");
$("#myframe").css("height",height);
$("#myframe").css("top",top);
});
$(window).resize(function() {
var url = "http://blog.csdn.net/shaobingj126/article/details/23676759/";
var index = detectZoom();
var width = index * 1+"%";
var height = index * 1.1+"%";
var top = index * (-0.1)+"%";
$("#myframe").attr("src",url);
$("#myframe").css("width","100%");
$("#myframe").css("height",height);
$("#myframe").css("top",top);
});
//查看浏览器缩放比例
function detectZoom (){
var ratio = 0,
screen = window.screen,
ua = navigator.userAgent.toLowerCase();
if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
}
else if (~ua.indexOf('msie')) {
if (screen.deviceXDPI && screen.logicalXDPI) {
ratio = screen.deviceXDPI / screen.logicalXDPI;
}
}
else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
ratio = window.outerWidth / window.innerWidth;
}
if (ratio){
ratio = Math.round(ratio * 100);
}
return ratio;
};
function detectZoom (){
var ratio = 0,
screen = window.screen,
ua = navigator.userAgent.toLowerCase();
if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
}
else if (~ua.indexOf('msie')) {
if (screen.deviceXDPI && screen.logicalXDPI) {
ratio = screen.deviceXDPI / screen.logicalXDPI;
}
}
else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
ratio = window.outerWidth / window.innerWidth;
}
if (ratio){
ratio = Math.round(ratio * 100);
}
return ratio;
};
阅读全文
0 0
- 使用iframe框架 截取外部部分页面嵌套(可以排除浏览器比例缩放影响)
- 实现类似浏览器的缩放页面比例
- 设置火狐浏览器默认页面的缩放比例
- 设置火狐浏览器默认的页面缩放比例
- 页面内iframe嵌套使用导致浏览器进度条始终处于loading状态
- 使用iframe制作页面框架
- 使用iframe进行框架嵌套的问题
- iframe里面使用外部整体框架属性
- 浏览器兼容问题项目总结(六) 页面嵌套多个iframe滚动条兼容性修改
- 浏览器兼容问题项目总结(六) 页面嵌套多个iframe滚动条兼容性修改
- 显示页面等比例缩放
- Iframe左侧页面缩放
- UIImage 图像截取,等比例缩放
- easyui框架jsp父页面使用iframe标签嵌套子页面传值并加载data-grid数据问题
- iframe嵌套跳转页面
- 页面嵌套iframe
- frame缩放 iframe随浏览器缩放
- JSP页面中使用iframe框架
- Android遍历数组、集合和Map
- 《Effective C++读书笔记》--条款08:别让异常逃离析构函数
- 以太坊命令
- vs中如何统计整个项目的代码行数
- $().each()遍历元素
- 使用iframe框架 截取外部部分页面嵌套(可以排除浏览器比例缩放影响)
- [Objective-C]关联(objc_setAssociatedObject、objc_getAssociatedObject、objc_removeAssociatedObjects)
- As 快捷键
- My solution to cs224n assignment1(3-4)
- Kernel包接收处理过程
- QT 5.1.0(MinGW)的安装及使用
- DevExpress GridControl List绑定方式下新增行的方法
- OpenGL 笔记(三) 图元的属性
- git 分支无法切换问题