惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
人人都是产品经理
人人都是产品经理
U
Unit 42
B
Blog RSS Feed
博客园 - 【当耐特】
T
Tailwind CSS Blog
V
V2EX
S
SegmentFault 最新的问题
美团技术团队
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
量子位
aimingoo的专栏
aimingoo的专栏
Stack Overflow Blog
Stack Overflow Blog
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
P
Proofpoint News Feed
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
About on SuperTechFans

博客园 - 重粒子

文件在线预览doc,docx转换pdf(一) vue中集成pdfjs自定义分页 使用 vs code 搭建vue项目(一) post文件下载 css 文本超出2行就隐藏并且显示省略号 js监听全屏下的esc事件 js实现全屏和缩放 ionic 侧栏菜单用法 weblogic获取应用目录路径(war包) 使用pdf.js预览实现读取服务器外部文件 js禁用浏览器后退 java批量将多文件打包成zip格式 AngularJS封装webupload实现文件夹上传 jquery监听滚动条 pdf预览(pdf.js) (钉钉)第三方WEB网站扫码登录 $q的基本用法 Jersey RESTful WebService框架学习(八)文件下载防乱码 巧用 Jersey RESTful WebService框架解决文件上传乱码
Angularjs自定义指令计算浏览器高度
重粒子 · 2018-03-27 · via 博客园 - 重粒子
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>柳絮飞祭奠</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="/APP-INF/plugins/angular/angular.js"></script>
</head>
<body>

<div lx-ui-auto="" height-remove="10" style="background-color: red;"></div>
</body>
<script type="text/javascript">
	var app=angular.module("app",[]);
 
	/**
	 * height-remove 设置窗口高度需要移除的高度值,如移除顶部导航高度50
	 * height-tag    设置是按height还是min-height设置高度值,height才会出现滚动条。
	 */
	app.directive('lxUiAuto', function($window) {
		return {
			restrict : 'A',
			scope : {},
			link : function($scope, $element, $attrs) {
				if($attrs.heightTag==undefined){
					$element.css("min-height", ($window.innerHeight-$attrs.heightRemove) + 'px');
				}else{
					$element.css($attrs.heightTag, ($window.innerHeight-$attrs.heightRemove) + 'px');
				}
			}
		};
	});
</script>
</html>

效果: